Morecambe went ahead early on through Kevin Ellison's low finish before Matty Blair levelled with a deflected shot.
Krystian Pearce headed the Stags ahead from Mal Bennings' corner but Shearer saved Shaun Miller's penalty when Ryan Tafazolli fouled Andy Fleming.
Shearer was the hero again in the second half as he saved Paul Mullin's spot-kick when Jack Thomas handled.
Mansfield keeper Scott Shearer saved two penalties as they survived a scare to seal three points against Morecambe.