Engineers have dynamited 250 cubic metres of rock that threatened to fall on Gurtnellen, in central Switzerland.
The explosion was triggered on Saturday morning and follows a landslide on Wednesday, which closed the railway line running through the Gotthard tunnel – connecting Zurich and Milan in Italy.
Rail traffic resumed at noon on Monday.
Geologists had said the hillside above Gurtnellen was unsafe following the landslide when 300-400 cubic metres of rock broke loose, partly blocking the railway line.
The dynamiting was reported to have been successful, and both the motorway and cantonal road were reopened to traffic, after being closed on Saturday morning.
Rail services through the Gotthard tunnel are not expected to be restored until Monday.
Buses have been organised for local passengers, while people travelling to Italy from Zurich, Basel and Lucerne are being rerouted via Brig, using the Simplon tunnel.
Swiss Federal Railways has warned that journeys can take up to 90 minutes longer.
In 2006 a car was crushed on the motorway near Gurtnellen and its two occupants killed, when an avalanche of rocks fell on the road. As more rocks fell, the road was closed for a month, and the overhanging rock was blasted away.
A year earlier two motorists had a lucky escape in a similar incident in the same area.
The road and railway run more or less parallel to each other in the narrow Reuss valley leading to the Gotthard tunnel.