NEW DELHI—Prime Minister Narendra Modi’s cabinet has approved the choice of Japan to build India’s first high-speed railway, an Indian government official said Thursday.

The multibillion-dollar deal comes as the two countries, Asia’s two largest democracies, have been strengthening ties in the last 18 months to build a counterweight to China’s growing influence.

It...