The world's biggest oil exporter posted 174.9 billion riyals in oil revenues in the second quarter, down 5pc compared with the same period a year earlier, and non-oil revenues of 85.8 billion, 4pc less than last year.
In the first quarter, the kingdom had a budget surplus of 27.8 billion riyals, its first surplus since 2014.
"The surplus reflected exceptionally high transfers from Aramco and that was not expected to continue in Q2," said Monica Malik, chief economist at Abu Dhabi Commercial Bank.
In the first half of the year, the kingdom posted an overall deficit of 5.68 billion riyals, according to data published by the Saudi ministry of finance on Tuesday.
The International Monetary Fund expects Saudi Arabia will post a deficit of 6.5pc of gross domestic product (GDP) this year against a government forecast of 4.2pc deficit.
Last year Saudi Arabia posted a budget deficit of 5.9pc of GDP.
The latest data showed Saudi Arabia's expenditures rose 5pc to 294.2 billion riyals in the second quarter from the same period a year earlier.
Expenditures rose 6pc in the first half of the year from the same period in 2018, broadly in line with a budgetary target of increasing spending by 7pc in 2019 to spur economic growth.
Capital expenditure rose 22pc in the first half of the year, reflecting government spending on housing and other development projects, Saudi Finance Minister Mohammed al-Jadaan said in a statement.
The internal and external borrowing during the first half of the year was 67.9 billion riyals, which the government said will be used to finance part of the expected deficit until the end of the year.
Saudi economic growth has been sluggish this year, hit by output cuts by oil producers to support prices.
A recent Reuters poll of economists showed Saudi Arabia's GDP will grow 1.7pc in 2019 and 2.1pc in 2020.
Three months ago, the forecasts were for growth of 1.8pc in 2019 and 2.2pc in 2020.