(Adds central bank estimates and context)
BRASILIA, Aug 23 (Reuters) - Brazil's current account deficit widened in July to $4.050 billion, central bank data showed on Tuesday, a bigger shortfall than expected by economists in a Reuters poll.
The recent appreciation of the Brazilian real has slowed the momentum of exports that benefited from lower production costs at home. The real has firmed more than 22 percent so far this year on the back of higher Brazilian interest rates and improving confidence.
The country attracted $78 million in foreign direct investment in July, contrary to forecasts in a Reuters poll for an outflow of $500 million.
The central bank said than outflows of capital stemming from a banking operation explain the drop in investment flows in July. The bank forecasts foreign direct investment will rebound to $7 billion in August.
It also expects the current account deficit to shrink to $800 million in August.
Brazil posted a current account surplus of $2.479 billion in June, and a deficit of $5.864 billion in July 2015. The market expected a shortfall of $3.6 billion for July. (Reporting by Marcela Ayres; Writing by Alonso Soto; Editing by James Dalgleish)