Elaia says it generates 14 percent of Portugal’s olive oil today, contributing to a renaissance in Portuguese exports, which now constitute 40 percent of economic activity. Drones buzz over vast olive groves, precision-planted with 2,000 trees per hectare, or roughly 2.5 acres, compared with around 150 trees for a traditional farm, monitoring crops for insect infestations, water levels and optimum harvesting time. Olives are picked by machine. Instead of field hands, the company hires technicians to operate the robots, and it has teamed up with universities for research.

“Portugal has benefited a lot after the tough years we had,” said Jorge de Melo, Sovena’s chief executive. “The mood is much better than it was before, and that’s important for the economy.”

Yet Portugal’s success is still vulnerable.

Growth is cooling from 2.7 percent last year, as Mr. Costa keeps public investment at a 40-year low to cut the deficit. While he restored public sector salaries to previous levels, they have barely budged since before the crisis. Social precariousness lingers, worsened by the spread of low-paying part-time contracts. And the minimum wage of 580 euros a month, although up, remains one of the lowest in the eurozone.