Prior made an unbeaten 110 and number 11 Monty Panesar saw off five balls as England finished on 315 for nine.
Stuart Broad batted 137 minutes for six runs before he and James Anderson were dismissed in the space of three deliveries to leave Panesar coming to the crease with 21 balls remaining.
But he stayed firm and it means the series ends all square after the first two games ended in rain-affected draws and England will retain their number two Test ranking.
Earlier Ian Bell had curbed his natural game to play the anchor role, plodding his way to 75 from 271 balls, but England had a fair share of luck. The hosts dropped three catches, Prior and Broad both were given out lbw to have the decision reversed after a review and the keeper also deflected a bouncer onto his stumps but it failed to dislodge the bails.
The tourists had resumed in brilliant sunshine on 90 for four and with little chance of reaching the 481 needed for victory, after New Zealand had put themselves into a strong position to win their first Test series against England since 1999 when they dismissed three top-order batsmen on Monday.
Bell and Joe Root had successfully negotiated the first 105 minutes of play when Trent Boult made a crucial breakthrough just before lunch when he trapped Root in front for 29 with the first delivery with the second new ball.
Bell was then dropped by Dean Brownlie at fourth slip in the final over before lunch from Boult before Jonny Bairstow was dropped by Kane Williamson in the gully two balls later.
Bairstow fell in the afternoon session when he nicked to Ross Taylor at first slip off Tim Southee for six, reducing England to 159-6.
The match was crackling with tension after Bairstow's dismissal as New Zealand's bowlers, knowing the Bell-Prior partnership was the one to break, charged in, seeking that one delivery that would tip the game in their favour.
Southee hit Prior on the pads twice in one over. One appeal was turned down, the next was successful, but the England wicketkeeper immediately asked for a review, knowing that he had nicked the ball into his legs first.
Less than 10 minutes later, Prior mistimed a pull shot from a Southee bouncer and Neil Wagner turned at mid-on and bolted 20 metres in a desperate attempt to make the catch that would place the hosts under huge pressure. His diving effort fell just short, however.
Wagner then hit Prior on the helmet and the ball dropped down the face of the stumps, bounced and spun back and nestled at the foot of the wickets, but failed to dislodge the bails both times.
The left-armer ultimately had the final say when a tired-looking Bell fell in the over before tea and New Zealand's players celebrated as if they had won the match.
Bell surrendered three balls before the break when he prodded at a Wagner delivery and it flew to Southee at third slip.
But Prior and Broad batted defiantly after tea. The 50 partnership came up with Broad yet to get off the mark and he finally played a scoring shot off his 62nd delivery with a thick edge past the slips.
Prior went on to complete his seventh Test century via his 18th boundary, reaching the milestone off 148 balls, but just as it seemed England were about to see out the draw, there was a late twist in the tail.
Part-time off-spinner Kane Williamson, who took two wickets late on day four, prompted Broad to edge to Ross Taylor at slip and Anderson followed for a duck swiftly after in identical fashion.
Panesar is one of international cricket's poorer number 11s but he helped save the first Ashes Test in 2009 with a defiant last-wicket stand and the dressing room could hardly watch after he almost chopped on from the final ball of Williamson's over.
Prior saw out Boult's next over before Panesar got off strike off the opening ball of the penultimate over, punching Williamson past the packed close fielders before diving too early as he tried to make his ground at the non-striker's end. A direct hit could have lead to an embarrassing finale.
But England's vice-captain could not get off strike, leaving Panesar to face the final over from Boult. He saw off the first two balls before driving a full toss down the ground for a single.
Prior dealt with the final three balls and a disappointing tour for England ended on a high note with a battling and thrilling draw.