A teacher in northern Nigeria walks three hours to school every day, no longer able to pay for a ride in a tuk tuk rickshaw. Bakers operate at a loss amid soaring flour prices. Workers in Lagos sleep overnight in their offices to avoid the prohibitive cost of commuting.

Since President Bola Tinubu of Nigeria was sworn in less than two months ago, he has shaken up his country with economic decisions that have been welcomed by investors and international backers, but been devastating to the livelihoods of many Nigerians.

Now the question is whether Nigeria, Africa’s most populous country, with 220 million people, will thrive or just get sicker from the bitter medicine dispensed by its new president.

Mr. Tinubu set off shock waves when he announced during his inaugural speech on May 29 that he was ending a fuel subsidy that for decades had given Nigerians some of the cheapest oil in Africa, but amounted to a quarter of the country’s import bill. Gas stations tripled their prices overnight. Transportation fares, electricity and food prices followed.

The government declared a state of emergency earlier this month to deal with the soaring cost of food, and said it will begin distributing grains and fertilizer to boost production.

Still, investors have rejoiced over Mr. Tinubu’s moves, considering them necessary to fix Nigeria’s ailing economy. Nigerian stock prices have reached their highest valuation in 15 years. Consultancies are buzzing that Nigeria is open for business again.

“It’s about short-term pain and long-term gain,” said Damilola Akinbami, a Lagos-based chief economist at Deloitte, a consulting firm. “Nigeria had reached a point where it was not if, but when it should remove the fuel subsidy.”

The impact has been far-reaching.

Atinuke Bolajoko, a 43-year-old civil servant in Ilorin, a city in central Nigeria, said she stopped feeding rice to her three children, and switched to gaari, a mixture made from processed cassava, and a dish usually consumed by low-income Nigerians.

“We’ve never seen prices so high in the market,” said Ms. Bolajoko, a single mother.

A spike in wheat prices following the collapse of a deal that allowed Ukrainian ships carrying grain to bypass a Russian blockade could worsen food insecurity even further, humanitarian groups have warned. Nigeria is one of the world’s largest importers of wheat and its national currency has sunk against the dollar in recent weeks.

In Kano, Nigeria’s second-largest city, Sani Mamman used to ride a three-wheeled tuk tuk taxi to the primary school where he teaches every weekday. But with his monthly salary of about $49, he said he can’t afford new daily round trip fares of $2, up from 75 cents before the fuel subsidy removal.

Instead of his usual thirty-minute commute, Mr. Mamman, a father of five, leaves shortly after his morning prayer and walks for nearly three hours, making it just in time for the beginning of classes at 8 a.m.

“Prices keep soaring every day, while our pay check has remained static for years,” he said.

Mr. Tinubu won Nigeria’s presidential election in March amid a historically low voter turnout and allegations of vote-rigging that his opponents have taken to court, where they are now awaiting a ruling. Many Nigerians who had been energized by a younger candidate regarded Mr. Tinubu as an ailing stalwart of the old guard, and expected that little would change from the administration of his predecessor, Muhammadu Buhari.

But his first two months in power may indicate otherwise, said Ms. Akinbami from Deloitte.

Mr. Tinubu has fired the head of Nigeria’s anti-corruption agency and the chief of its central bank, whom he blamed for leaving the country’s financial system “rotten.” The bank’s new leadership has eased foreign exchange rates to reduce the gap between the official and black-market rate, a key demand of international backers.

Yet the fast-paced moves come with little cushioning and amid multiple crises. Earlier this year, massive cash shortages left countless Nigerians unable to buy essential items. Kidnappings and a jihadist insurgency hamper business activities.

More than a third of Nigerians are now unemployed. Two thirds of the country’s 220 million people live in poverty, with an additional seven million expected to join them this year, according to the World Bank. This month, inflation reached nearly 23 percent.

“The cost of living crisis that the West has been complaining about for the last two years? Nigeria has faced that for the past eight years,” said Joachim MacEbong, a senior governance analyst at Stears, a Nigerian data and intelligence company.

“While Buhari kicked the can down the road,” Mr. MacEbong added, “Tinubu immediately ripped off the Band-Aid.”

In Lagos, Nigeria’s largest city, many office workers now spend the night in their offices to save on transportation.

Most experts agree that the removal of the oil subsidy should free much-needed resources. Nigeria is Africa’s second largest oil producer, but its refineries remain largely dysfunctional, so it imports most of the refined fuel that it uses. That has left its economy highly dependent on fluctuating exchange rates and international oil prices.

In 2020, when prices were low, Nigeria paid about $350 million in oil subsidies. Last year, it paid $10 billion, nearly 30 times more.

In the first six months of this year, it spent twice as much per capita on the subsidy as on education, and at least three times as much as on health.

Mr. Tinubu has yet to announce changes in those sectors. But the ongoing crisis has threatened to make it even harder for Nigerians to access health care and afford medications, doctors said in interviews.

Tosin Agbaje, a junior resident doctor training in mental health at a hospital in southwestern Nigeria, said that the number of patients he tends on an average day went from 10 to two since the fuel subsidy removal.

“It means more relapse, more deaths at home,” he said.

To soften the blow, Mr. Tinubu’s government said it would increase the supply of grain and fertilizer and raise the salaries of civil servants. It has also vowed to give cash to Nigeria’s poorest households, although an initial plan to provide a monthly emergency stipend of about $10 for the next six months was paused after many blasted the plan as insufficient.

Mr. Mamman, the primary schoolteacher in Kano, said he hoped his family would qualify for any government relief, to help him pay bills and maybe buy a bike to get to work.

“Nigerians are ready to sacrifice to improve the lives of future generations,” Mr. Mamman said. “But it must be done with policies that have a human face.”

Pius Adeleye contributed reporting from Ilorin, Nigeria.