The 57km (35-mile) twin-bore Gotthard base tunnel will provide a high-speed rail link under the Swiss Alps between northern and southern Europe.
Switzerland says it will revolutionise European freight transport.
Goods currently carried on the route by a million lorries a year will go by train instead.
The tunnel will overtake Japan's 53.9 km Seikan rail tunnel as the longest in the world and push the 50.5 km Channel Tunnel linking the UK and France into third place.
German Chancellor Angela Merkel, French President Francois Hollande and Italy's Prime Minister Matteo Renzi will join Swiss officials at the grand opening.
"It is just part of the Swiss identity," federal transport office director Peter Fueglistaler told Reuters news agency.
"For us, conquering the Alps is like the Dutch exploring the oceans."
The project, which cost more than $12bn (£8.3bn) to build, was endorsed by Swiss voters in a referendum in 1992. Voters then backed a proposal from environmental groups to move all freight travelling through Switzerland from road to rail two years later.
The completed tunnel travels up to 2.3 km below the surface of the mountains above and through rock that reaches temperatures of 46C.
Engineers had to dig and blast through 73 different kinds of rock, some as hard as granite and others as soft as sugar. More than 28m tonnes of rock was excavated. Nine workers died during the work.
Now the completed tunnel - delivered on time and within budget - will create a mainline rail connection between Rotterdam in the Netherlands and Genoa in Italy.
When full services begin in December, the journey time for travellers between Zurich and Milan will be reduced by an hour to two hours and 40 minutes.
Its trajectory will be flat and straight instead of winding up through the mountains like the old rail tunnel and a road tunnel opened in 1980.
About 260 freight trains and 65 passenger trains will pass through the tunnel in as little as 17 minutes.
The tunnel is being financed by value-added and fuel taxes, road charges on heavy vehicles and state loans that are due to be repaid within a decade.
Swiss bank Credit Suisse has said its economic benefits will include the easier movement of goods and increased tourism.