To take the pulse of Brazil, drive an hour from Sao Paulo to the port at Santos, the busiest in Latin America.

Curving inland from emerald waters and high-living beachfront condos, the harbor in the five-century old city is home to teeming favelas of huts on stilts, terminals loaded with goods fueling an economic rebound and, increasingly, cocaine. The port complex is a 3-square-mile microcosm of a country buffeted by political turmoil, drug-fueled violence and persistent income inequality as it emerges from a grinding recession. Will the turnaround take hold? There are answers, of a sort, in the sprawl of stacked containers and towering cranes.

The port regained the region’s No. 1 status in 2015, surpassing the two that straddle the Panama Canal. That was a marker, but this year holds the big promise: In the first quarter, agricultural sales to foreign customers led Brazil out of its worst slump on record. Rising imports, particularly for car parts and capital goods, provide a glimpse of the rally in domestic demand that’s finally underway. With almost 13 million people unemployed, resurgence can’t come soon enough. Agriculture’s upturn has been feeding into other quarters as the economy plods toward broad-based growth, says Marcelle Chauvet, a University of California, Riverside, economics professor who sits on a committee that tracks Brazil’s economic cycles at the Getulio Vargas Foundation. “One sector’s recovery pulls the other ones up, and then it’s like a domino effect.”

Port of Santos
Port of Santos

Containers are loaded with coffee, soybeans, corn and more—including cocaine. Santos authorities have seized a record 11.5 tons so far this year, finding it squirreled away in shipments of anything from sacks of sugar to frozen pig heads. Traffickers are always looking for new tricks; recently they’ve been pulling up alongside ships headed out to sea and coordinating with crew members who drop lines to hoist the illicit cargo aboard, said Santos’ federal police chief, Júlio César Baida. Police caught a skiff motoring out of one of the port’s favelas in August and the ensuing shootout left four smugglers dead.Violent competition over key trafficking routes erupted in late 2016 after Brazil’s two biggest gangs ended a 23-year truce, notes Robert Muggah, research director at Instituto Igarapé. The rise in homicides boosts the appeal of right-wing politicians calling for looser gun control and vigilante justice, he says, while repressive policing and incarceration practices have strengthened the power of organized-crime groups. According to Muggah, “The tough-on-crime approach is actually exacerbating cycles of violence and marginalization.”

Marginalization is on display within the port, which is home to three favelas (Portuguese for slum or shanty town). Recent studies have cast doubt on the extent to which the commodities-led boom of the past decade helped reduce inequality. One from the World Wealth & Income Database, co-directed by the French economist Thomas Piketty, found considerably higher inequality than official estimates suggest—with the top 10 percent of earners accounting for more than half of national income. Rising wealth concentration is a threat to economic growth, Piketty contended in his best-seller, Capital In The Twenty-First Century, and to a functioning democracy.

Santos is at the heart of the last remaining corruption investigation threatening President Michel Temer. The Supreme Court has authorized a probe into alleged bribes paid by executives of terminal operator Rodrimar in exchange for a presidential decree that extended operators’ concessions. Rodrimar denies receiving any favorable treatment, noting that the order didn’t benefit it alone, and Temer has denied wrongdoing. Already Temer has dodged two corruption trials that lawmakers voted down, following three years of sprawling scandal. With presidential elections looming next October, nearly nine of 10 Brazilians say it’s “very important” their candidate have no involvement in corruption cases.

The fact that the federal government controls aspects of Santos, including concessions, underscores its national importance: It accounts for about 30 percent of all trade. But the port authority’s market relations director, Cleveland Sampaio Lofrano, says the single biggest takeaway from a trip he and other executives took to the port in Antwerp in September was that they should be operating with autonomy.

That’s not necessarily in store, though the government is working to reduce bureaucracy that creates bottlenecks for businesses. That includes eliminating some paperwork and instituting online services, such as a foreign-trade portal that’s nearing completion and authorities estimate will reduce export time by at least 40 percent. It’s part of a wider effort to shore up the economy’s incipient recovery, and set a course for long-term growth.