Ahead after nine minutes thanks to a Wayne Rooney goal, it was not until eight minutes from time that substitute Michael Carrick finally made the points safe for the Red Devils.
United squandered countless chances and Pompey did enough to worry Old Trafford's army of home fans.
United took the lead with a superb goal, crafted by Anderson's glorious long pass from just inside the Portsmouth half to Ryan Giggs on the left.
It was a hairline decision as to whether or not Giggs was onside, but the United veteran collected the ball skilfully, before producing a measured low cross into the penalty area where Rooney was left with a simple right-foot tap-in from six yards.
The home side were denied a second goal on the half-hour when substitute John O'Shea connected with a Giggs corner at the near post, only to see Nadir Belhadj head the ball off the line at the far post.
Pompey's England goalkeeper David James was to prove a giant stumbling block to United's attempts to improve their goal difference.
James saved brilliantly from Giggs at point-blank range after he head been freed by Rooney, while the England man himself was also thwarted by the Portsmouth goalkeeper.
Giggs and Darren Fletcher went close for United in the latter stages of the first half, but the Red Devils went off the boil after the interval.
Pompey right-back Glen Johnson's mazy run down the right and along the byline ended with United goalkeeper Edwin van der Sar forced to palm away the England defender's dangerous cross.
Peter Crouch missed two chances to equalise - the second a header from eight yards which was kept out by the diving van der Sar.
Rooney was again denied by James, but United finally clinched victory in the 82nd minute.
Paul Scholes, making his 600th appearance for United, slotted an inch-perfect pass through for Carrick on the right side of the Pompey penalty area and he beat James with a low right-foot shot into the far corner of the net.