The 36-year-old, who retired at the end of last season after making 676 appearances in his 17-year United career and winning 10 Premier League titles, opened the scoring with a fierce 20-yard strike after just eight minutes in the testimonial game.
'I hope I gave them a few decent memories,' said Scholes, who was joined by Pele on the pitch at the end of the game to say his goodbyes.
The occasion also saw another United legend, Eric Cantona, returning to Old Trafford in his new role as director of football at the Cosmos.
The Frenchman greeted Scholes before kick-off and was given a reception louder than that afforded to Pele, who is also part of the Cosmos' campaign to win a place in Major League Soccer in 2013.
The Cosmos were a trail-blazing club in the 1970s in the US when their team featured Pele as well as the likes of Johan Cruyff. Wayne Rooney, Anderson, Danny Welbeck and Mame Biram Diouf (two) were United's other scorers.