Anthony Martial and Paul Pogba struck in the closing minutes to hand Manchester United a deserved 2-1 win against Middlesbrough at Old Trafford.
United dominated the 90 minutes, raining 32 efforts down on the Boro goal but were denied twice by the post, once by a contentious refereeing decision and on multiple occasions by their former goalkeeper Victor Valdes.
When Grant Leadbitter lashed home his first Premier League goal in almost eight years it looked as though a scarcely believable upset was on the cards but Martial and Pogba found the net in quick succession during a frantic last five minutes.
That left United boasting a six game winning streak heading into 2017, a stark contrast to the eight games without victory that Louis van Gaal brought up in the club's final fixture last year.
While the Red Devils certainly did things the hard way, they were fine value for the points with both goalscorers hitting the woodwork previously and Zlatan Ibrahimovic unfortunate to see his kung-fu style finish ruled out for high feet.
It was, though, hard on Valdes - a pariah of the Van Gaal era but excellent under severe pressure for 85 minutes on Saturday.
United can count themselves unlucky not to have taken a first-half lead.
That they did not score was partially down to Boro's resistance, Ben Gibson and George Friend snuffing out a handful of dangerous moves, but the frame of the goal also had its say.
First came Pogba's wonderful overhead kick, the Frenchman agonisingly close to adding a finishing touch worthy of Martial's raking cross-pitch delivery and Henrikh Mkhitaryan's delicate cushioned header.
When United hit the post a second time, in the 38th minute, it was less about the build-up and more about one sensational strike of the ball from Martial.
The Frenchman's 30-yard effort would have been unstoppable by human hand but cannoned back off the post with a thud.
United did breach Boro's back line moments later, Martial playing creator with a floated cross for Ibrahimovic, but the referee blew for dangerous play.
Ibrahimovic certainly got his boot well into Valdes' eyeline but he also showed enough athleticism and timing to get it down again before colliding with his opponent.
On the sidelines Mourinho recreated the finish in rather less supple fashion as he disputed the decision with the fourth official and his frustration felt apt.
United might also have scored had Marouane Fellaini not headed straight at the keeper from a corner, or if Valdes had reacted less quickly to a Mkhitaryan snap-shot on the half-hour.
Yet Boro can have their own regrets, largely around Adama Traore's decision to shoot rather than pass from an early counter-attack.
The visitors will have welcomed a chance to regroup at half-time, having been pushed deeper and deeper, but United came out bristling and only Valdes' alert performance kept them out.
United kept pouring forward but Mourinho was becoming increasingly tetchy and made a double change, Juan Mata and Marcos Rojo for Fellaini and Daley Blind.
Then Boro played their joker.
Calum Chambers launched a deep cross from the right, Alvaro Negredo cushioned with his head and the advancing Leadbitter took his shot at glory with aplomb.
If the journeyman midfielder could hardly believe it, Mourinho gave him a run for his money.
United were stung into another spell of all-out attack, Ibrahimovic again denied by Valdes and substitute Marcus Rashford immediately causing consternation with a tricky run and cross on the left.
Rashford went down in the 79th minute under pressure from debutant defender Espinosa Bernardo, with Lee Mason's 'no penalty' decision drawing laughter from Mourinho.
Time was almost running out when Ibrahimovic nodded down a long ball from the back and Martial cracked home a deserved finish to cap an electric display.
But United were not done and put Boro away just two minutes later.
Mata played his part, pushing wide and crossing for Pogba, who placed his header expertly into the top corner.
United were out of jail and three points better off but there will be no doubts about how close they came to being unseated.