The opening goal came from an Andy Taylor corner in the 47th minute. Skipper Antony Kay found space to head into the left-hand corner as the Posh defence hesitated.
The visitors were out of luck on the hour mark as Aaron Mclean's strike from 20 yards came back off the post with goalkeeper Danny Coyne well beaten.
Mclean brought a fine diving save from Coyne and then Craig Morgan headed just wide from the subsequent corner.
Substitute Dominic Green struck the crossbar with a 73rd-minute free-kick and George Boyd was denied by a post from 25 yards after 81 minutes.
Tranmere sub Chris Shuker then rattled the crossbar in the 84th minute. Mclean stabbed home the equaliser from Charlie Lee's pass in a crowded area at the death. And Mackail-Smith hit the winner from a 30-yard Lee shot which appeared to be going well wide.