I think Exeter schools are rated higher, if for no other reason than that Exeter doesn't have the socio-economic diversity you find in a city, which tends to bring scores down. It also has the private boarding/day school Philips Exeter Academy, which attracts a lot of brainpower. I've always heard that the public school was considered solid but not stellar.
Greatschools.net Search: portsmouth
In terms of best public school systems on the Seacoast, New Castle and Hampton Falls are really highly rated through middle school but then go to less highly rated high schools. York, ME has a really highly rated school system all the way through and is just a few minutes from Portsmouth.