Aidan O'Shea scored a late goal to make certain of the victory
Aidan O'Shea's late goal ensured Mayo resisted a second-half comeback from Westmeath to book their spot in the All-Ireland quarter-final.
Westmeath outscored their Connacht counterparts in the second period, but it wasn't enough to see them overturn an eight point half-time deficit.
John Heslin did his utmost to keep the game competitive as he notched a total of nine points, but suffered a couple wayward shots early in the game.
Shooting in the opening stages of the game left much to be desired, wides also coming from Cillian O'Connor early on in proceedings.
Heslin did finally find his rhythm from the dead ball with two early frees, before Evan Regan added his opening score of the afternoon.
Just minutes later, Westmeath were dealt the first big hammer blow of the afternoon. Jason Doherty stole into the box and rifled his low shot past Darren Quinn into the bottom corner of the net.
It looked as if it would be a long afternoon for Westmeath and after Regan's second point of the afternoon, Tom Cribbin's side sunk further into the mire.
The Westmeath goalkeeper caught the ball in his own area but was forced to over-carry the ball and concede the penalty, which Cillian O'Connor sent into the top corner of the net.
James Dolan then threw Westmeath a lifeline with a goal from pretty much nothing. A speculative effort from distance nestled in the bottom corner of the net. They could have been right back into the contest when they cut out a Mayo goalkick directly afterwards, but couldn't convert.
Jason Doherty scores the first goal of the game. Image: ©INPHO/Lorraine O'Sullivan
Westmeath made a fast start to the second period, a flurry of points James Dolan, Frank Boyle and another Heslin free saw them score 1-5 without reply.
Cillian O'Connor got Mayo off the mark in the second period followed closely by Jason Doherty, but Westmeath showed good resolve and tried to drive at the Mayo defence at every opportunity.
Scores continued too reign down on the Mayo goal, but it was a second goal that Cribbin's side were chasing. After cutting the gap to three they continued to loft high balls in but to no avail as the Mayo sweeper continued to mop up any loose ball in front of goal.
A red card for Denis Corroon came as a result of a second yellow card for a tackle on Donal Vaughan, which somewhat hampered Westmeath's progress.
Cillian O'Connor killed off any hope of a comeback with a late point before Aidan O'Shea made sure of the win with a third goal for Mayo.
They'll now face Tyrone in the quarter-final of the competition, knowing they still have quite a bit to work on if they are to topple the Ulster champions.