The 177ft (54m) Ayrshire crossing, whose track is higher than the Forth Bridge’s, has been designated a National Historic Civil Engineering Landmark after being upgraded to carry heavier coal trains.
The viaduct, which crosses the River Ayr between Mauchline and Catrine on the Glasgow-Dumfries line, also has the UK’s largest masonry arch with a span of 181ft (55m).
A ceremonial plaque was unveiled at the base of the viaduct by ICE president Geoff French and East Ayrshire Provost Jim Todd.
Mr Todd said: “Ballochmyle Viaduct is a masterpiece – even 166 years after its original construction, it is still in good condition and in main line use.”
The bridge appeared in the 1996 film Mission Impossible when Tom Cruise was seen on top of a train, battling Jean Reno in a helicopter.
Duncan Sooman, head of engineering for Network Rail, which owns the viaduct and was responsible for the upgrade with contractors Carillion, said: “We are particularly pleased to have strengthened this magnificent structure to carry the heaviest coal trains without any visual effect on its appearance.
“This is a further example of our commitment to retaining heritage structures fit for a modern railway”
The seven-arch crossing was designed by Ayr-born John Miller, who the ICE said was often described as “Scotland’s Brunel”.
He also built the main Edinburgh-Glasgow line, which is claimed to be the world’s first inter-city railway line.
The prolific railway designer’s work also included the Edinburgh-Berwick-upon-Tweed route, the first cross-Border rail link, and the Edinburgh-Hawick section of the Waverley line to Carlisle.
Mr French said: “John Miller possessed the same foresight and professionalism that our predecessors applied to create the lasting legacies of historic infrastructure in times past.
“It is vital we encourage the next generation of civil engineers and instil in them the same ambition and skill to continue Scotland’s rich engineering heritage.”