Two trucks have crashed into Melbourne bridges in one day, with a large semitrailer becoming wedged underneath a bridge on the Upfield railway line in North Melbourne.

Racecourse Road was closed to inbound traffic and trams were diverted for several hours after the large truck hit the rail bridge near Boundary Road and Stubbs Street about 12.40pm.

Traffic became congested in the Flemington area as firefighters tried to move the truck, a difficult job with the length of its two trailers stuck underneath the rail bridge.

The electric overhead tram lines underneath the bridge were also seriously damaged in the collision and were left hanging on the road next to banked-up trams.