In the 19th century, the customs house here brimmed with the imported wares that first helped this tiny Spanish-speaking nation become part of the wider world economy.
During a balmy weekend last month, the old brick and iron warehouse was packed again, this time with multilingual financial analysts and software developers attending a job fair organized by Costa Rica's foreign-investment promotion agency.
Among the opportunities that lured some of the 8,300 job-seekers was the possibility of a job with Amazon.com - a company that, since 2008, has morphed into a major employer here with more than 4,000 workers.
"I buy stuff from them all the time," said Ginette Morales, a 35-year-old MBA graduate with experience in the financial-services industry, who was among dozens milling about Amazon's booth at the job fair.
Amazon's investment, and that of other multinational companies, helped make Costa Rica an important provider of a broad suite of corporate services for global firms, who employ local software engineers, accountants and lawyers as well as customer-support and back-office staff.
It's a relationship that's worked well for the tiny Central American nation - a formerly agrarian country that has leveraged a skilled population to carve itself a profitable niche in the world economy. It also helps corporate behemoths tap into a global vein of talent, often at a cost that's half the amount it is in the U.S.
The model illustrates the proliferation of cross-border supply chains that surged in two decades of nearly unfettered globalization. It's a model, however, that's being challenged by a sweeping tide of economic populism that helped put Donald Trump in the White House.
The change in the U.S. political mood, and Trump's willingness to use social media to lambaste companies he perceives as job exporters, has prompted many firms, including Amazon, to focus attention on how many American jobs they're creating.
Costa Rican officials acknowledge the changing landscape in Washington, D.C., and understand how U.S. companies might become sensitive to it. "Nobody wants in this moment to exhibit themselves ... and earn a tweet," Costa Rica's foreign-trade minister Alexander Mora, said in an interview.
But Mora, who estimates that about 27,000 Costa Ricans work in corporate services related to the U.S. market, argues that this sector of the economy is likely to grow. That's partly because of strong links with the United States, but also because Costa Rica offers skills in short supply in the U.S. labor market, such as software development.
Also, on the lower end of the skill set, many technical- and customer-support roles at U.S. companies operating here are geared to serve Spanish- and Portuguese-speaking markets in Latin America and elsewhere.
"Our services sector is very complementary with that of the U.S.," Mora said.
Seattle-based Amazon declined to comment for this story and wouldn't provide access to its Costa Rica facilities.
But last September, before Trump's election, Amazon was trumpeting the addition of 1,500 jobs in Costa Rica, bringing its local head count there to 5,500.
That's less than 2 percent of Amazon's total worldwide workforce of 341,400, but the company's Costa Rican payroll makes it a big fish in this country of less than 5 million. According to government data compiled in November by El Financiero, a local financial newspaper, Amazon was the fifth-largest private employer in Costa Rica.
Alejandro Filloy, the company's chief in Costa Rica, in December told El Financiero that Amazon's operations have become increasingly complex and now include software developers as well as risk analysts that investigate fraud in retail transactions.
The company also has a team of seller-support analysts who help independent merchants navigate Amazon's online marketplace.
Amazon's Costa Rica staff provide human-resources support for its U.S., Europe and Latin American operations, fill strategic roles in defining the customer experience in Mexico and Brazil, and include cloud-computing personnel, El Financiero reported.
A recent look at Amazon's job website showed 66 open positions in Costa Rica, ranging from content developers to financial analysts and French-speaking fraud- investigation specialists.
Amazon's culture is evident here in the groups of blue-badge-wearing employees, some of them conversing in American English, that stream out of buildings at two locations in the San Jose metropolitan area. One of the buildings sports a big sign that proclaims, in English, "We are hiring!"
"Talent is what we have to offer," Filloy told El Financiero. "We started with services of lower added value, and we responded with world-class quality."
Costa Rica's transformation from a banana- and coffee-exporting economy into a purveyor of sophisticated corporate services owes a lot to geography and national policies.
It's a stable democracy, in a region often beset by instability, and just three hours away from Miami. It's a ready signatory of free-trade treaties, guaranteeing plenty of markets for its goods and services.
Its ties to the U.S. are strong and devoid of tensions stemming from trade imbalances or immigration. Mora, the foreign-trade minister, points out that there are more Americans living in Costa Rica than there are native-born Costa Ricans living in the U.S.
Costa Rica spends a lot of money on public education; it was an early proponent going back to the 19th century. Some 6.9 percent of government spending in 2012 went to education, versus a global average of 4.4 percent.
English is a priority and widely spoken - and languages such as Portuguese, German and French are making inroads, too.
In the past decade, when bigger regional neighbors such as Venezuela and Argentina turned against free trade, Costa Rica embraced it.
Costa Rica also has a knack for aggressive, global self-promotion. It has mustered the same energy that it's deployed in championing democracy to lobby big companies to come to the country. Ticos, as Costa Ricans call themselves, sought to emulate Ireland, a formerly poor country that catapulted itself to tech stardom through open trade and by encouraging foreign investment.
The watershed moment in Costa Rica came in 1997, when Intel decided to open a microchip plant near San Jose, a decision one Intel executive noted was like "putting a whale in a swimming pool."
Sykes, a Tampa, Florida-based business-process outsourcing company, set up shop here in 1999, followed by Hewlett-Packard and IBM. They helped create an increasingly sophisticated labor pool that newcomers could tap into.
An early wave of call centers gave way to back-office operations for the likes of Citibank, Procter & Gamble and Amazon
VMware, a California enterprise-software provider that is an Amazon partner, arrived in 2012. Its general manager in San Jose, Ariel Vargas, cut his teeth in the first wave of call centers that popped up here in the 1990s.
He remembers the early days, when the first VMware office in San Jose had a paper sign outside with the company's name on it and just 18 employees in a space that could accommodate 48.
In 2015 VMware graduated to a five-story building in the Zona Franca America, an expansive development that operates under special economic rules for foreign investors and looks like a U.S. office park. Some 540 people now work in the building with Silicon Valley-style amenities including free drinks and snacks.
Staffers handle tasks ranging from tech-application support to human resources, legal affairs, marketing and finance. Even the person who handles the online gadget that provides real-time financial information to VMware's CEO in California is based in San Jose, Vargas said.
"VMware has identified an opportunity to grow in Costa Rica, providing services not only to the Americas region, but to the world," Vargas said.
Jorge Sequeira, the head of Costa Rica's foreign-investment promotion agency, or CINDE, said the provision of corporate services for global companies is the fastest-growing sector of the economy.
At the end of 2016 it employed some 54,000 people, or 3 percent of the country's workforce. That tally is up 5,420 from the previous year and far more than the 1,000 jobs it had in the year 2000.
Corporate-service staffers working in free-trade areas such as Zona Franca America earn average salaries of about $2,000 a month, more than twice the average for other service-sector workers in the country.
Costa Rica's corporate-services sector successfully harnessed the opportunity created by a rapid evolution of telecommunications, Sequeira said in an interview.
But it was also aided by a breakdown of "mental barriers" - the belief that only first-world countries had the skills needed for white-collar corporate tasks, he said.
The corporate-services sector has an outsized impact in the national economy: In 2016 it generated revenues of $4.6 billion, nearly as much as tourism, another strong sector here.
The export of telecommunications, information and other corporate services represented about 6.2 percent of Costa Rica's gross domestic product in 2015, much higher than other countries in the region. The percentages in Brazil and Argentina, for instance, were about 1.1 percent, according to CINDE.
As much as Costa Rica gains from the corporate-services sector, foreign-trade minister Mora noted, so does the U.S., as its flagship companies benefit from Costa Ricans' creativity to further their global expansion.
"This is a case in which we all win," he said.
—-
About Costa Rica
Population: 4.9 million
Official language: Spanish
Gross domestic product per capita: $16,100 (54th in the world)
GDP growth rate (2016): 4.3 percent
-Source: CIA World Factbook
Explore further: Intel lays off of 1,500 employees in Costa Rica