It overtakes the 25.8-kilometer Iwate Ichinohe tunnel on the same line as the world's longest tunnel on land, chief planner Hideo Ueda said.
"In the Swiss and Spanish projects, two single-track tunnels were dug. But Hakkoda has double tracks and was technically more difficult," Ueda said.
The 34.6-kilometer Lotschberg base tunnel in Switzerland and the 28.4-kilometer Guadarrama tunnel in Spain are expected to be completed in a matter of weeks.
The Hakkoda tunnel, near Aomori city on the northern tip of Japan's main island of Honshu, has cost 66.7 billion yen (635 million dollars) to construct since it was launched six and a half years ago.
The land tunnel is the third longest tunnel in the world after two undersea structures - the 53.9-kilometer Seikan tunnel which was built in 1988 between Japan's Honshu and Hokkaido islands and the 50.5-kilometer "Chunnel", which was completed beneath the English Channel in 1994.