A road vehicle struck a bridge at Lochgelly, resulting in a delay to rail services.
The incident took place on Friday shortly before 3pm.
The line between Glenrothes with Thornton and Cowdenbeath was closed but reopened after 6pm.
Trains between the stations are now returning to normal.
Ticket acceptance was put in place with Stagecoach East buses to help ease disruption.