A lorry hit a railway bridge causing a brick wall to fall on the tracks below and closing the railway line.
The bridge in Castle Cary, Somerset, carries traffic on the A371 Station Road over the railway line between Westbury and Weymouth.
The lorry was removed at 16:00 BST following Tuesday morning’s incident and the line reopened at about 19:15, a spokesman for Network Rail said.
Services are expected to return to normal on Wednesday.
But disruption was expected for the rest of Tuesday evening and passengers were advised to check with rail operator GWR.
The nearby main line between London and Cornwall was closed for a time, but reopened earlier.
Devon and Somerset Fire and Rescue service said the driver of the lorry was released and taken to hospital.