Mayo had to come from behind to register a 2-17 to 3-09 win over Westmeath in a thrilling Allianz Football League Division 1 clash at Cusack Park, Mullingar.

The back-to-back All-Ireland finalists surrendered a nine-point first-half lead to trail the hosts in the second period.

But a storming finale allied to a collapse from hosts Westmeath resulted in James Horan's side picking up their second win of the campaign.

Lee Keegan and Michael Sweeney scored Mayo's first-half goals though it was Mayo’s point-scoring in the closing stages that won it, nine unanswered points meaning the visitors could afford to surrender a 70th-minute goal to Westmeath forward James Dolan - his second of the day.

Westmeath had the worst possible start, leaking a goal to Keegan after just three minutes. Kevin McLoughlin, Alan Freeman, Enda Varley and Aidan O'Shea all went on to score points before Mayo’s second goal from Mickey Sweeney.

The corner-forward was fortunate to sweep up a breaking ball after Donal Vaughan's long punt and hit the net from close range.

All Westmeath could muster in response was a solitary John Heslin converted free as they trailed 2-04 to 0-01.

The hosts looked destined for their fourth straight defeat but conjured an incredible comeback to lead by one point at half-time. It represented a 10-point swing in just 25 minutes after being brilliantly led by the two Dolans in the full-forward line, James and Dessie.

Kieran Martin pulled back Westmeath’s first goal after beating goalkeeper Rob Hennelly to a high ball.

Three more converted frees from Heslin buoyed the 6,600 home support before Dolan shot the Lakesiders’ second goal.

It was a superb goal as Paul Sharry picked out Dessie Dolan with a diagonal ball before a clever offload to cousin James who hammered home into the net.

The strike left the sides level and Westmeath took a scarcely believable half-time lead when Martin pointed to leave them 2-08 to 2-07 ahead.

Another Heslin free put Westmeath two clear early in the second-half. Crucially, Paul Bealin’s men failed to score again until Dolan's late goal after Mayo had come roaring back into the game.

The visitors shot five points to take a 2-12 to 2-09 lead, McLoughlin and Freeman delivering a brace of scores each.

Westmeath rued a number of wides in this period including misses from Denis Glennon and Jamie Gonoud.

And Mayo capitalised in the final ten minutes with points from subs Cillian O'Connor and Brian Gallagher to record a comfortable win.

Mayo: R Hennelly, K Keane, B Harrison, G Cafferkey, L Keegan (1-02), D Vaughan, C Boyle, A O'Shea (0-02), J Gibbons, K Higgins, K McLoughlin (0-03, 1f), J Doherty, E Varley (0-01), A Freeman (0-05, 3f), M Sweeney (1-00).

Subs: D Drake (0-01) for Keane, C O'Connor (0-01, 1f) for Varley, S O'Shea for Gibbons, M Conroy for Sweeney, B Gallagher (0-02) for Doherty.

Westmeath: D Quinn, S Gilmore, K Gavin, K Maguire, P Sharry, J Gilligan, J Gonoud, D Duffy, J Heslin (0-05, 5f), K Martin (1-01), G Egan, D Harte, D Glennon, J Dolan (2-02), Des Dolan (0-01).

Subs: D McCormack for Harte, D Corroon for Duffy, C Carolan for Higgins.

Referee: E Kinsella (Laois).