The Real Madrid forward opened the scoring on four minutes from the penalty spot before Diego Costa's low finish levelled proceedings at Sochi's Fisht Stadium.
Ronaldo struck again on the stroke of half time, with David de Gea letting a shot squirm through his fingers, but La Roja struck twice just before the hour mark to surge into the lead.
Nonetheless, the former Manchester United and Sporting Lisbon man rattled home a superbly-taken free kick to salvage a point for the Euro 2016 victors.
Ronaldo's performance yielded plaudits from fans and pundits worldwide, though Shearer questioned the 33-year-old's set piece accuracy at major tournaments and stressed that his second goal was due to De Gea's error.
"One or two will ask why I said at half time that Ronaldo needs to work on free kicks," Shearer told BBC Sport.
"Well, it's his 45th attempt at major championships - and he's done it today.
"His second goal was due to a very rare De Gea mistake. Ronaldo takes a gamble to his right, but it should have been a basic save."
Ronaldo's hat-trick against Spain was the 51st of his career.