RIO DE JANEIRO, Brazil — Brazil has at least 6 million fewer houses than it needs. And now, as the country's booming economy fuels a real estate bubble, it's the poor who are getting squeezed out.

As the makeshift apartments in Rio’s slums sprout extra stories, real estate experts say Brazil’s shortage of affordable housing has reached a breaking point.

Buyers are reeling from a one-two punch: countrywide inflation coupled with speculation as Brazil prepares to host the Olympics and World Cup. Industry insiders worry the mounting costs are threatening to place homes beyond the reach of Brazil’s biggest, most promising market — middle and low-income buyers.

Just ask Eleazar Rodrigues, 64. The wiry real estate broker has spent several decades selling and managing apartments in the Complexo do Alemao slum, a labyrinth of cramped streets and hand-built homes on the city’s gritty north side that is home to more than 100,000 people.

Tucked into an apartment’s concrete stairwell, Rodrigues’s office sees a steady stream of increasingly pinched customers. “There’s no place left to build anymore,” he said.

Home prices here have shot up three even four times in recent years, he explained, telling several visitors that the free vacant lots that once drew people here simply don’t exist.

“It’s a bit of a crisis,” said Rio real estate investor Ruban Selvanayagam. “The prices have gone up so much, they’re just completely out of reality with what people can afford.”

The problem is most acute for those on the bottom rungs of the country’s economic ladder. Brazil now suffers from a housing shortage of about 6 million homes. And people earning a monthly salary of $1,000 or less account for about 90 percent of the deficit.

To pay for the vast majority of houses coming onto the market, prospective homebuyers now must be able to handle mortgage payments of about $300 to $400 per month, Selvanayagam said.

In a country where the World Bank estimates the average monthly income is $670, spiking mortgage costs could eat up half a family’s income.

A government program has been launched in part to tackle this problem, but it has gained little traction this year. Known as “Minha Casa, Minha Vida,” or “My House, My Life,” the program was supposed to give grants to middle- and lower-middle-class workers who would use the money to make down payments on new homes. The goal was to spur the building of 2 million new homes by 2014 — 60 percent of which would be occupied by families earning $1,000 per month or less.

The program has failed to meet its house-building goals since it launched in 2009, and so far this year, zero grants have been issued. “The fact that they haven’t even started a project is a pretty good sign things are in a bit of a mess,” Selvanayagam said.

Even if the program moves forward, some veteran observers of Rio’s inequality are skeptical it will have much impact in shantytowns like the Complexo do Alemao. To be eligible for the grants, prospective homebuyers must submit documents proving they have the income necessary to keep up with a mortgage payment. That means legions of poor people who work off-the-books jobs will be excluded.

“Anyone who works in the informal sector doesn’t have any way to estimate their income,” said Janice Perlman, author of the book “Favela,” a four-decade study of poverty in Rio’s slums. “So really it was a plan for government workers, and people who really weren’t the ones who most need help.”

The lack of housing options for Brazil’s poorest may be another example of what Perlman described in her book as one of the country’s principal ills: the fact that “the poor simply do not exist in the mental map of the wealthy.” It took almost 100 years before Rio’s informal slums, or favelas, were even included on actual city maps, she said, “during which time the number of inhabitants grew to a third of the total city population.”

In a recent interview, Perlman remarked upon a city where the deficit of affordable housing isn’t just an abstract economic fact: hand-built favelas cover every available hillside, even in the wealthy sections of town. Indeed, one such community covered the hill facing her.

“The evidence,” Perlaman said, “is everywhere.”