This figure is lower than the median forecast of a surplus of 6.993 billion dollars in a Reuters poll.
Imports rose 41.6 percent in July from the same month last year to $24.511 billion, the economy minister said.
Exports increased by 23% to $29.955 billion, the minister added, noting that higher prices boosted results in both cases.
This effect has been accentuated in recent months, with the war in Ukraine putting pressure on commodity prices and particularly affecting Brazilian fuel purchases.
Since the start of the year, the trade surplus of Latin America’s largest economy has reached $39.751 billion, compared to $44.380 billion for the same period in 2021.
Last month, the government downgraded its outlook for this year’s trade balance from an estimated $111.6 billion surplus in April to an $81.5 billion surplus, due to a largest increase expected for imports.