Dunfermline staged a crucial comeback this afternoon in the Scottish Championship.

Early on both teams showed high energy and looked for chances, just five minutes in Kevin O'Hara looked close as he aimed for an open goal but was just stopped by Ayr keeper Aidan McAdams.

Ayr followed this up with a shot from Tomi Adeyole at close range, but Jakub Stolarczyk kept the score even with a good save.

At 25 minutes on the clock Joe Chalmers looked for an opportunity, but sent the ball just over the bar.

Things went south soon after when a Coll Donaldson foul against Adeyole resulted in a penalty for Ayr.

Aaron Muirhead stepped up and sent the ball past Stolarczyk into the left hand corner of the net, putting the away side in the lead.

Ayr had one more opportunity before half time, when Adeyole made a close shot at the net, but hit the ball just past the post.

The match went to half time at Ayr 1-0 Dunfermline.

The Pars came back a different team for the second half, with Ayr flagging.

At 54 minutes an effort from Lawless looked promising, but the ball went behind.

Dunfermline called for a penalty after it looked like a handball from Muirhead, resulting in a booking for Liam Polworth.

Reece Cole was brought out at 69 minutes and not ten minutes later equalised for Dunfermline in a free kick after a foul on Lewis McCann.

This livened up Dunfermline fans, who until that point had been looking defeated.

Substitutes continued to prove successful for the Pars, as Nikolay Todorov scored just two minutes after coming on to the pitch, putting Dunfermline in the lead with just minutes to go.

This turn of events was well received by fans, who were out of their seats and on the pitch.

The last opportunity of the match came from Steven Lawless, but hit shot hit the post.

The full time whistle blew with the score Dunfermline 2-1 Ayr United.

Dunfermline are now level in goal difference with Ayr with just two games left to play.

Dunfermline: Stolarczyk, O'Hara (Todorov, 84) Edwards, Ambrose, Donaldson (McCann, 45), Chalmers (Kamwa, 69), Thomas (Cole,69), Todd, Pybus, Polworth, Lawless.

Subs not used: Mehmet, Breen, Jones, Dow, Comrie, Wishart.

Bookings: O’Hara (38), Polworth (68), Pybus (86)

Goals: Cole (79), Todorov (86)

Ayr: McAdams, Houston (Fjortoft, 77), Reading, McGinty, Muirhead, O'Connor (McKenzie, 77), McInroy, Murdoch, Maxwell, Ashford, Adeloye.

Subs: Albinson, Baird, Kenyon, Smith, Gondoh, Ecrepont, Guthrie.

Bookings: Muirhead (78)

Goals: Muirhead (35)

Referee: Colin Steven

Attendance: 4855