By Declan Rooney at Pearse Stadium
There was no dream finale to Dublin's Leinster SHC campaign as Paul Winters's second-half brace of goal proved insufficient at Pearse Stadium.
Jason Flynn hit 11 points for his side including the winning free in the final minute as Galway claimed a fourth win of the summer and set up a provincial final against Kilkenny in three weeks time.
Joseph Cooney wasted little time starting the scoring for the Tribesmen, and after Paul Ryan hit Dublin's first point - he had already missed a free and was relieved of the duties before the break - Sean Loftus and Conor Whelan gave Galway a 0-3 to 0-1 lead by the sixth minute.
With Fiontan McGibb impressive up front Dublin kept in touch with Ryan and Rian McBride on target, but the home side hit four in a row between the 15th and 20th minutes to take control.
While he didn't score in the opening half Niall Burke made an impact - he was one of four changes to the starting line-up - and it was his quick free in the 16th minute that gave Joseph Cooney and easy score for the Tribesmen.
Ryan and Danny Sutcliffe hit back to Dublin to trim the lead to three points, but with Ryan off target with a couple of frees, Galway hit four more points without reply to work their way into a 0-16 to 0-9 lead.
This game looked to be petering out into a straight forward Galway vitory, but Dublin emerged for the second half with a real pep in their step. Points from a Rian McBride sideline cut and Cian Boland was the perfect start, and when Skehill missed a long delivery half-time sub Paul Winters squeezed the ball over the line from a tight angle.
Dublin still trailed by three point though, but by the 48thminute they were ahead.
Flynn's free settled Galway after the goal, but they failed to make a further impact on the back of that score. Instead Gilroy's side hit their second goal of the game and once more Galway looked suspect at the back.
It was Jake Malone's long delivery into space that freed Winters, but when the Galway defence opened up in front of him he buried a blistering shot into the roof of Skehill's net.
Still a point behind, it fell to goalkeeper Alan Nolan landed to give Dublin the lead with two long range frees .
Despite Flynn edging Galway ahead again, a Treacy free and a long range Rian McBride point pushed Dublin clear again, but two late points from David Burke and Flynn's frees rescued Galway.
Galway: J Skehill; P Killeen, Daithi Burke, A Harte; P Mannion (0-3), G McInerney, J Hanbury; S Loftus (0-1), David Burke (0-2); J Cooney (0-3), N Burke, C Mannion (0-1); C Whelan (0-3), C Cooney (0-2), J Flynn (0-11, 9f).
Subs: E Burke for Loftus 43, S Cooney for Killeen 50, D Glennon for C Cooney 68, P Brehony for J Cooney 73.
Dublin: A Nolan (0-2, 2f); P Smyth, C O'Callaghan, E O'Donnell; S Barrett, S Moran (0-1), C Crummey; R McBride (0-4, 1'sl), T Connolly; J Malone (0-1), F McGibb, C Boland (0-1); D Treacy (0-4, 3f), D Sutcliffe (0-1), P Ryan (0-3, 3f).
Subs: E Dillon for Connolly 35, Winters (2-1) for Ryan 35, C McBride for Boland 47, J Madden (0-1) for McGibb 65, J McCaffrey for McBride 73.
Referee: Diarmuid Kirwan (Cork).