(Adds data on current account as percentage of GDP, context)
BRASILIA, Aug 22 (Reuters) - Brazil posted a current account deficit of $6.018 billion in July, central bank data showed on Friday, growing more than expected from the month before.
The country had been expected to post a deficit of $5.8 billion, according to the median forecast of 15 analysts in a Reuters poll. Brazil's current account deficit in June was $3.345 billion.
Foreign direct investment in Latin America's largest economy was $5.898 billion in July, above market expectations of $5.4 billion.
The current account is a country's widest measurement of foreign exchange flows, including trade, services, interest payments and remittances. Brazil's current account deficit has widened sharply over the last two years owing to a dwindling trade surplus that had its weakest result in a decade in 2013.
The current account gap as percentage of gross domestic product narrowed to 3.45 percent in the 12 months through July from 3.58 percent in the previous month. (Reporting by Silvio Cascione and Luciana Otoni Editing by W Simon and Tom Brown)