The vehicle struck the 4.2m (13ft) high bridge near Railway Street on Kingston Road, Taunton, at about 08:00 GMT.
The A3102 was partially blocked while the vehicle was being freed but has now been re-opened in both directions.
Network Rail said engineers had inspected the bridge and found "no damage" and trains were running normally.
Drivers faced delays after a lorry hit a railway bridge in Somerset and became stuck.