Rooney looked to be on the verge of leaving Old Trafford during the summer months, with Chelsea interested in the England international.
The former Everton teenager stayed and has become one of United's stand-out players this season, and Shearer thinks that Moyes should be praised for the way he has handled Rooney.
"You would be amazed how much of a huge difference it makes to a player's confidence, even one with huge ability, when someone puts an arm round him, tells him that he loves him and says he wants him to stay," Shearer told The Mirror.
"Credit to David Moyes. There's a huge difference between that and the body language which says, 'I don't want you, I don't believe in you anymore.'
"Rooney is now playing with a spring in his step again, and up front he is first pick for the World Cup, no doubt about that."
Rooney has scored seven goals for the Red Devils this season.