Bryan McMahon's 63rd minute goal was the crucial score as Meath lived dangerously in Navan before escaping to victory in the Leinster SFC.

The Royal County, promoted to Division 1 in the Allianz league and strong favourites to progress, trailed by four points with 15 minutes to go.

But an unanswered 1-04 blast including that goal from McMahon propelled them to victory and a quarter-final clash with Carlow on 25 May.

McMahon finished with 1-02 while Mickey Newman hit 0-4 for the 2010 champions though it was far from comfortable against John Maughan's Offaly.

The visitors scored seven points in a row early in the second-half and put themselves in a winning position but couldn't finish it off and will head now to Round 1 of the qualifiers on 8 June.

Offaly were bidding for a first away win in the Leinster championship in 22 years and hinted initially that they might have some success in Navan.

With Niall McNamee back involved in Championship football for the first time since June 2017, and converting two early frees, they led 0-04 to 0-02 after 20 minutes.

McNamee had an exciting duel with Meath full-back Conor McGill while Shane Gallagher tracked Bernard Allen, Offaly's leading scorer in the league.

Peter Cunningham impressed early on at midfield for Offaly and his second point of the game tied things up at 0-05 apiece.

McNamee put Offaly ahead briefly before the Royals closed out the half with four points in a row to open up a three-point lead for the first time.

Captain Bryan Menton, Thomas O'Reilly, Cillian O'Sullivan and Newman were all on the mark as the hosts led 0-09 to 0-06 at half-time.

But it was far from a classic contest with Meath, the strong favourites, looking tentative and nervy as Offaly sought to capitalise on their underdogs tag.

Offaly 'keeper Paddy Dunican was one of three Faithful debutants and blasted two frees wide in the first-half. The Division 3 outfit, who narrowly avoided relegation, hit seven first-half wides and 14 in total and rued them.

But they restarted with gusto and were terrific in the third quarter, striking six points in a row to move from three behind to three in front.

McNamee scored three of those six points while Allen conjured a beauty when he turned his man and clipped one over.

The blitzkrieg of scoring left Offaly 0-12 to 0-09 ahead and Shane Horan, another debutant, moved them four clear with his first of the game.

Meath were in real trouble now and brought on former captain Graham Reilly in attack for the last 20 minutes.

His first act was to win a free that Newman converted, beginning a period of dominance that ultimately hauled Meath to a battling win.

Meath hit 1-4 in total without reply in the closing minutes with McMahon's 63rd minute goal the crucial score, moving them from a point behind to two ahead.

It was sub James Conlon who dropped his score attempt short but McMahon broke the ball before bundling it in from close range. Conlon himself closed out the Meath scoring with a 72nd minute point.

Meath: Andrew Colgan; Seamus Lavin, Conor McGill, Shane Gallagher; James McEntee, Donal Keogan, Gavin McCoy; Bryan Menton (0-02), Shane McEntee; Cillian O'Sullivan (0-02), Bryan McMahon (1-02), Ben Brennan (0-01); Barry Dardis, Michael Newman (0-04, 0-03f), Thomas O'Reilly (0-01).

Subs: Adam Flanagan for S McEntee (h/t), James Conlon (0-01) for Dardis (42), Graham Reilly for O'Reilly (50), Sean Tobin for Brennan (52), Eoin Lynch for J McEntee (54), Padraic Harnan for Newman (75).

Offaly: Paddy Dunican; Declan Hogan, Eoin Rigney, David Dempsey; Cian Donohoe, Johnny Moloney, Niall Darby (0-01); Eoin Carroll (0-02), Peter Cunningham (0-02); Shane Horan (0-01), Anton Sullivan, Cathal Mangan; Bernard Allen (0-02, 0-01f), Niall McNamee (0-06, 0-04f), Ruairi McNamee.

Subs: Shane Tierney for Sullivan (55), Joseph O'Connor for Horan (59), Paul McConway for Carroll (65), Mark Abbott for R McNamee (66), Conor Carroll for Cunningham (72).

Referee: Martin McNally (Monaghan).