Manchester United beat West Ham 2-1 at Old Trafford thanks to two penalties from Paul Pogba.
However, the visitors will feel aggrieved to not come away with at least a point after squandering a number of second-half chances.
Scholes claims West Ham deserved to win the match and that Ole Gunnar Solskjaer will be disappointed at how his team played.
But ultimately he says the three points was most important as United look to finish in the Champions League qualification places.
“Yeah [the result] is exactly what he [Solskjaer] got,” Scholes said on BT Sport.
“I don’t think he will be too happy with what he’s seen.
“It wasn’t a great performance but they’ve done what they need to do which was to win the game.
“I think you have to give West Ham credit as well, I thought they played some really good stuff at times.
“They were unlucky where [Michail] Antonio hit the crossbar and a great save from [David] De Gea.
“But United needed to win the game and they done that.
“Yeah just about [West Ham deserved to win], I think they did.
“I was impressed with West Ham, I thought they played some really good stuff.
“Okay United will probably use the excuse of being tired after the Barcelona game.
“But when you’re at Manchester United you’re expected to play in big games in midweek and perform again on the Saturday, especially against teams like West Ham.
“You need to put these teams away early and they were very slow, very pedantic at times, which was a little bit disappointing.
“But as I say they did what they needed to do which was to win the game.”