JK was succeeded by much lesser men. Neither Jânio Quadros (who lasted only six months in power) nor his vice president and successor, João Goulart, possessed the skill necessary to deal with rising inflation or resolve the growing social conflicts that pitted urban workers against factory owners and rural peasants against rich landowners. Moreover, with a Cold War fear of communism in the air, Goulart’s leftist leanings terrified the Brazilian right (including the military), particularly when the new president decided to explicitly support the trade unions and peasant organizations.
On March 31, 1964, with implicit backing of the U.S. government, led by a small group of right-wing generals, military troops carried out a quick and nonviolent coup. While Goulart was deposed and went into exile in Uruguay, the generals set to work transforming Brazil  into a military dictatorship. Humberto Castelo Branco became president—the first in a series of generals to lead the country by iron rule over the next quarter of a century. Congress was dissolved, political parties were banned, unions were outlawed, and the media was censored.
The situation grew even more drastic when General Emílio Garrastazú Medici took over in 1969. The next five years proved to be the most brutal of Brazil’s military regime. Thousands of people were arrested, jailed, tortured, and even killed for even the most indirect criticism, “subversive” political beliefs, or the expression of ideas deemed unsuitable by the regime. Many leading artists and intellectuals (among them leading musicians such as Chico Buarque and Gilberto Gil, along with professor and later president Fernando Henrique Cardoso) went into exile during these years.
While Brazil’s dictatorship was less hard-line than those of its neighbors, Chile  and Argentina —where hundreds of thousands were made to “disappear”—there was widespread hatred of the military leaders, who were not only cruel, but corrupt as well.
During the first decade of military rule, Brazil experienced phenomenal rates of economic growth that surpassed 10 percent a year. This period became known as the “Economic Miracle.” Industry boomed and an exodus of workers from the poor Northeast  migrated en masse to the manufacturing hub of São Paulo , which grew to become Latin America’s financial and economic powerhouse. While many found factory jobs and other low-wage employment, others clustered in shacks on the growing city outskirts. Indeed, while some Brazilians grew rich, far more remained miserable as these slums, known as favelas, began to mushroom in major cities.
To further stimulate development, the government drummed up foreign investors to finance immense (and controversially dubious) mega projects such as the Itaipu Dam , near Iguaçu Falls , and the Transamazônica highway (which opened up access through the impenetrable forest, all the way to the Peruvian border). The problem came when the oil crisis of 1974 punctured the Economic Miracle. By the beginning of the ’80s, as inflation soared and Brazilian currency took a nosedive, foreign investors started clamoring for Brazil to pay up its enormous and constantly multiplying debts.