They lived on their wits at times at Croke Park but Mayo eventually came good to secure their first win in the Super 8s, keeping their All-Ireland title hopes intact.
James Horan's side couldn't shake off a determined Meath for almost an hour and trailed by a 0-12 to 0-11 with 16 minutes to go.
But they outscored the Royal County from that point on by 2-06 to 0-02 to shake off the disappointment of their Phase 1 defeat to Kerry and record a significant win.
The result means they retain a fighting chance of qualifying for the All-Ireland semi-finals though Meath will kick themselves for not pushing on.
The beaten Leinster finalists had a chance to take the lead when the scores were tied at 0-12 apiece in the 57th minute but young sub Shane Walsh dropped a free-kick short.
Mayo scored from the next play and it kick-started a period of dominance that included 62nd and 76th minute goals from Kevin McLoughlin and Cillian O'Connor.
They'll be back in action on Saturday week at home to Donegal and will be delighted of the weekend off after a punishing schedule of games.
Meath desperately wanted a win to crown a breakthrough season under Andy McEntee.
They gained promotion to Division 1 of the Allianz league in spring and followed that up by reaching a first Leinster final in five years.
They also wanted to ensure that there's still something to play for when Kerry visit Navan in the final round of the Super 8s on Saturday week.
They gave themselves a fighting chance of grabbing a result with a battling first-half display and were competitive until the last 10 minutes or so.
The sides were level four times throughout the opening half and finished up locked on 0-07 apiece at the interval.
Chris Barrett, Kevin McLoughlin and Fergal Boland were all late additions to the Mayo lineup and both McLoughlin and Boland got on the score-sheet in the first-half.
Ultra experienced Barrett picked up rising Meath star James Conlon who put in the hard yards but was held to a solitary point.
Ethan Devine was influential in the Meath attack and forced a turnover that led to a Bryan Menton point before he split the posts himself.
Cillian O'Sullivan and Seamus Lavin closed out the first-half with Meath points to tie it up at half-time though the loss of Mickey Newman just before the interval with a leg injury robbed them of their key forward.
Walsh, who has just completed his Leaving Cert, came on for Newman and proved to be a reliable replacement, taking over the free-taking duties and slotting five of them.
He also won a 56th-minute free from a nice angle on the left but his kick wasn't convincing and dropped short.
From the resulting play, Mayo engineered an attack and Colm Boyle slotted a point to put them 0-13 to 0-12 ahead.
It was a see-saw encounter that possessed all the drama of a knock-out tie with the sides level three times in the opening 20 minutes of the second-half.
Mayo brought all their big game experience to bear on the contest in the closing minutes, stretching the gap with points from Lee Keegan and James Carr before McLoughlin's killer goal.
It came from a Meath kick-out that was turnover and the excellent Keegan picked out McLoughlin who fired home from close range.
It was all over when Mayo won a penalty deep into injury-time and O'Connor, despite the initial shot being blocked, struck to the net with his follow up.
Mayo: David Clarke; Chris Barrett, Brendan Harrison, Stephen Coen; Donal Vaughan, Colm Boyle (0-01), Lee Keegan (0-01); Aidan O'Shea, Seamus O'Shea; Fionn McDonagh (0-02), Kevin McLoughlin (1-01), Jason Doherty (0-02); Cillian O'Connor (1-05, 0-04f), Darren Coen (0-01), Fergal Boland (0-02).
Subs: Andy Moran (0-01) for D Coen (h/t), James Carr (0-01) for Boland (48), Eoin O'Donoghue for S Coen (56), James McCormack for S O'Shea (63), Michael Plunkett for Keegan (74), Ciaran Treacy for McLoughlin (75).
Meath: Andrew Colgan; Seamus Lavin (0-02), Shane Gallagher, Conor McGill; Donal Keogan, Padraic Harnan, Gavin McCoy; Bryan Menton (0-01), Shane McEntee; James McEntee (0-01), Bryan McMahon, Ethan Devine (0-01); Cillian O'Sullivan (0-01), Michael Newman (0-02, 0-01f), James Conlon (0-01).
Subs: Shane Walsh (0-05, 0-05f) for Newman (35+2), Barry Dardis for McCoy (50), Sean Tobin for Devine (53), Thomas McGovern for Lavin (65), Thomas O'Reilly for McMahon (66), Marcus Brennan for Colgan (75, black card).
Referee: Ciaran Branagan (Down)