RIO DE JANEIRO — Brazil’s government said Wednesday that Sweden’s Saab won a long-delayed fighter-jet contract initially worth $4.5 billion to supply at least 36 planes to Latin America’s biggest nation.

The decision to buy the Saab jet over Boeing’s F-18 Super Hornet or France’s Dassault Rafale came as a surprise to many. Some analysts said Boeing’s bid was hurt by reports that the U.S. conducted extensive spying in Brazil, including a direct targeting of President Dilma Rousseff’s communications.

Defense Minister Celso Amorim said the choice after some 15 years of debate was made after “careful study and consideration, taking into account performance, transfer of technology and cost, not just of acquisition but of maintenance.”

Swedish Foreign Minister Carl Bildt went on Twitter to call the decision “a tribute to Swedish technology and competitiveness.”

Unlimited Digital Access. $1 for 4 weeks.

Many had expected the choice to be between the Boeing and French planes. Former Brazilian President Luiz Inácio Lula da Silva had favored the Dassault Rafale, while Rousseff was said to favor the F-18.

Revelations six months ago that the U.S. National Security Agency’s (NSA) espionage program included widespread spying on Brazil was likely a factor in Saab being chosen, some analysts said. Anger in Brazil led Rousseff to cancel a planned state visit to Washington in October.

Carl Meacham, director of the Americas program at the Washington-based Center for Strategic and International Studies, said the NSA stories made it politically impossible for Rousseff to go with Boeing and that the decision will be another blow to U.S.-Brazilian relations already “at a significant low.”

Alexandre Barros, a political-risk consultant with the Brasilia-based firm Early Warning, disagreed the NSA was a big factor. Saab was favored by Brazil’s air force, according to an internal assessment leaked to the newspaper Folha de S. Paulo in 2010, and Barros said it always was going to win the competition.

He said many in the government long opposed Boeing because the company’s bid was less flexible about technology transfers than the two European plane makers and also because they were wary of becoming indebted to Washington.

Associated Press reporters Jenny Barchfield in Rio de Janeiro, Karl Ritter in Stockholm and Stan Lehman in São Paulo contributed to this report.