NEW DELHI—India’s economic growth slowed to a six-year low last quarter as debt problems at banks choked business and consumer spending in Asia’s third largest economy.

The gross domestic product growth slipped to 5.0% in the three months through June compared with a year earlier, the government said Friday, its worst performance since the end of 2012. The figures show one of the world’s engines of growth is weakening amid other warning signs that global economies are slowing.

India lost its position as the world’s fastest-growing large economy this year. The latest figures not only put it behind China—which expanded 6.2% during the quarter—but also behind Indonesia and Hungary.

“These are difficult times for India,” said Devendra Pant, chief economist at the India Ratings & Research. “The economy is going through a tough phase. Private consumption, which is the backbone of growth, is showing signs of weakness.”

India needs its economic growth to climb back toward 8%, economists say, if it wants to provide the jobs it needs to employ the millions of people who enter its workforce every year. India’s inability to so far claw its way of this rut is also bad news for the many international companies—including Amazon.com Inc., Walmart Inc. Samsung Electronics and Coca-Cola Co. —that cumulatively have invested tens of billions of dollars in the South Asian nation in anticipation of the birth of a giant middle class that would buy more of their products.