Ole Gunnar Solskjaer's side lacked sharpness in their penultimate pre-season friendly and wasted a host of chances - Jesse Lingard and Marcus Rashford the prime culprits.
Scott McTominay hit the post in the first half, too, and a draw seemed on the cards until Mata went down in the penalty area in stoppage time.
The Spaniard stepped up to take the spot-kick and coolly converted, sparing Solskjaer's blushes against a Kristiansund side who sit seventh in the ongoing Eliteserien.
Much of the pre-match build-up surrounded Noah Solskjaer, the 19 year-old son of the Manchester United boss who has occasionally featured for Kristiansund's B team.
Solskjaer Jr. was a late substitute, while new Manchester United signings Aaron Wan-Bissaka and Daniel James started for the visitors.
The chances came thick and fast in a one-sided opening half but Kristiansund held firm with a mix of defiant defence, a goalkeeper in inspired form and the odd stroke of luck.
Defender Christoffer Aasbak produced two vital interventions in the space of four minutes, first producing a last-ditch challenge that deflected a Lingard effort over before he cleared a dangerous Luke Shaw cross that James was waiting to tap in at the far post.
Kristiansund keeeper Sean McDermott was called upon at regular intervals - saving sharply from a Rashford free-kick, denying the same player with his legs and producing a one-handed stop to keep out a Lingard strike.
United's first half was summed up by McTominay's 42nd-minute strike that he thrashed into the woodwork before watching it bounce away to safety.
Kristiansund should have taken a shock lead six minutes into the second half but Sondre Sorli missed the target with a free header from close range and the near-miss kicked Solskjaer's men into action.
Rashford forced a one-handed save from Serigne Mor Mbaye, who replaced the excellent McDermott, while Solskjaer made 11 changes in a bid for the elusive first goal.
Mason Greenwood fired into the side netting and Fred then curled wide before the decisive moment, as Mata went down softly after Andreas Vaikla - the third goalkeeper to play in the match for Kristiansund - rushed off his line.
United have one more pre-season friendly remaining and will take on AC Milan on Saturday. A clash against Chelsea - now managed by former player Frank Lampard - will follow on the first weekend of the Premier League season.