(Adds details of earnings and call with journalists)
By Marcelo Rochabrun and Ana Mano
SAO PAULO, July 31 (Reuters) - Brazilian planemaker Embraer SA on Tuesday posted an unexpected second-quarter net loss after a flight testing incident with a KC-390 military cargo jet prototype ate into revenue from its defense division.
Embraer, the world's third-largest planemaker, said it lost $126.5 million in the latest quarter, missing the average estimate of a $48 million net profit in a Thomson Reuters survey of six analysts and down from a profit of $62 million a year earlier.
The KC-390 prototype went off a runway during a May ground test, causing damage that forced Embraer to use another aircraft for flight testing, delaying its delivery timeline and reducing net revenue by $127 million in the quarter.
Embraer had expected to deliver the first KC-390 aircraft by the end of 2018 but it will now begin deliveries next year. In May, the company had said extensive damage to the prototype's landing gear and structural parts of the fuselage would not affect its delivery timeline.
Chief Financial Officer Nelson Salgado told journalists on a conference call that the incident was an "operational matter, not a problem with the aircraft."
Excluding the onetime impact of the flight testing incident, Embraer's earnings before interest, taxes, depreciation and amortization (EBITDA) rose 90 percent from the prior quarter to $171 million, due in part to strong performance of its services and support division.
Embraer shares were flat in midday Sao Paulo trading after losing more than 3 percent at opening and rebounding to gain nearly 2 percent.
A 20 percent drop in second-quarter jet deliveries to airlines from a year earlier, which Embraer reported earlier this month, also weighed on revenue.
In July, Embraer agreed to sell 80 percent of its commercial aviation division — its largest and most profitable segment — to Boeing Co..
Under the proposed deal, Embraer would retain control of its executive jets and defense divisions, both of which posted weaker revenue than a year earlier.
The partnership, which the companies expect to close by the end of next year, still requires final approval from Brazil's government, which holds a strategic veto in the company. Presidential candidates vying to take office in January have come out for and against the deal.
Left-wing politicians and Brazilian labor prosecutors have also launched legal challenges to the deal.
Earnings before interest, taxes, depreciation and amortization (EBITDA) fell by 83 percent to $44 million, missing an average forecast of $142.5 million. (Reporting by Marcelo Rochabrun and Ana Mano Editing by Brad Haynes, Louise Heavens and Jonathan Oatis)