Four goals - along with a 74th minute point from David Nally - was just about enough to get Offaly over the winning line in a brilliant Joe McDonagh Cup game in Tralee, a result that puts the Faithful county into pole position to secure a top two finish in the group and qualify for the final.

The result, meanwhile, has all but scuppered Kerry's hopes of reaching that final, as the Kingdom now have to go to unbeaten Antrim next week absolutely needing to win to give them what might be the slimmest of hopes of qualification.

Knowing it was a win-or-bust game for both teams didn’t see either hold back at a sun-splashed Austin Stack Park, with both teams contributing to a brilliant, open game of hurling.

Nally’s huge point from 85 metres in the 74th of 75 minutes played eventually tipped the result Offaly’s way, though Colin Walsh’s score a minute earlier looked as if it might have earned the hosts a point. There wouldn’t have been too many complaints had it ended in a draw, though the point would still have left Kerry needing to win in Antrim.

The first half was a story of two Offaly goals and a missed Kerry penalty, which was, in fact, a wonderful save from Stephen Corcoran to push Shane Conway’s low strike around the post. Padraig Boyle salvaged a point from the '65’ but Kerry would, in the end, rue the two missed scores.

Eoghan Cahill had pointed Offaly into an early lead from a free, but when Kerry full back Eoin Ross raided forward to clip a point and make it 0-03 to 0-02 to the visitors, Kerry looked to have settled.

But in the very next play David Nally picked out Killian Sampson who struck a fine shot past Louis Dee in the Kerry goal to send Offaly four clear, 1-03 to 0-02. Three Padraig Boyle scores – two frees and one from play – brought it back to 1-06 to 0-06 after 15 minutes, and Kerry really should have been on level terms a minute later with that Conway penalty, which Fionnan O’Sullivan won after being put through on goal by Fionan Mackessy.

Michael Fennelly's side went a long way towards sealing a Joe McDonagh Cup final spot

Five minutes later Sampson turned provider for Nally to crack a low shot beyond Dee to make it 2-07 to 0-08 as Offaly looked to put some distance between themselves as a gutsy Kerry side that kept battling away.

Cahill converted a free and then hit two great scores from play, while Padraig Boyle kept Kerry in touch with a couple of frees confidently converted from near each sideline.

Kerry midfielder Walsh made a brilliant 60-metre solo run but his shot at goal rose just over the crossbar when he clearly had a goal on his mind. Nevertheless, Kerry trailed by just three at half time, 2-12 to 0-15.

Kerry struck for six of the first seven points after the restart from Shane Conway (3), Padraig Boyle (2) and substitute Jordan Conway, with Shane Conway’s second – a superb sideline cut – giving Kerry the lead for the first time in the game, 0-20 to 2-13, which he extended to 0-21 to 2-13 a minute later.

Offaly were momentarily rattled but Killian Sampson reacted best to Paddy Clancy’s shot that came off the post and crashed in his second and Offaly’s third goal to make it 3-13 to 0-22.

In a wonderful spell then for Offaly, they hit Kerry for 2-6 without reply – their fourth goal coming from John Murphy – as they went 10 points ahead after 55 minutes.

There hardly seemed any way back into the game for Kerry at that stage but substitute Maurice O’Connor struck for a goal in the 58th minute and repeated the dose six minutes later to make it 2-23 to 4-20.

Thereafter it was a battle of wills as much as anything, with Nally coming up with three great scores, none more important than the very last which was the slim difference at the end of a thrilling contest.

Kerry: Louis Dee, Flor McCarthy, Eoin Ross (0-01), Eric Leen, Sean Weir, Mikey Boyle, Fionan Mackessy (0-02), Michael Leane, Colin Walsh (0-02), Padraig Boyle (0-15, 10f, 2 ‘65), Colm Harty (0-01), Paudie O’Connor, Fionnan O’Sullivan, Niall Mulcahy, Shane Conway (0-05, 0-01 s/l).

Subs: Conor O’Keeffe for F McCarthy (2), Jordan Conway (0-02) for F O’Sullivan (ht), Maurice O’Connor 2-00 for C Harty (50), Brian Lonergan for N Mulcahy (69).

Offaly: Stephen Corcoran, Jack Screeney, Ciaran Burke (0-01), David King, Eoghan Parlon, Ben Conneely (0-01), Ross Ravenhill, Adrian Cleary, Jason Sampson (0-02), Brian Duignan (0-01), Eoghan Cahill (0-10, 7f), Killian Sampson (2-00), David Nally (1-03), John Murphy (1-01), Luke O’Connor (0-01).

Subs: Paddy Delaney for R Ravenhill (7), Paddy Clancy (0-01) for A Cleary (ht), Padraig Cantwell for E Parlon (43), Liam Langton (0-02) for L O’Connor (45), Shane Dooley for E Cahill (65).

Referee: Rory McGann (Clare)