This was down slightly from the year to May (5.0%).
The Land Registry noted that the annual growth rate has slowed since mid-2016 but has remained broadly around 5% during 2017.
The average UK house price was £223,000 in June 2017 – £10,000 higher than in June 2016 and £2,000 higher than last month.
A report last week from Oxford Economics warned that the UK should expect sluggish house price growth until 2021, with “house prices caught between a lack of traditional drivers of accelerating growth, but equally an absence of forces which have typically caused prices to fall”.
Of the four home nations, England saw the biggest increase in house prices (5.2%) with the average price in England now at £240,000.
Northern Ireland saw an increase of 4.4% over the year to quarter two (Apr to June) with its average house price at £129,000.
Wales (3.6%) and Scotland (2.9%) saw more modest increases over the year, with averages homes in these countries costing £152,000 and £144,000 respectively.
The East of England (7.2%) and East Midlands (7.1%) both drove the house price rise with above 7% increases.
Meanwhile the North East saw the lowest annual growth where prices rose just 2.5% over the year.
London’s stagnation also continued as prices in the capital rose by just 2.9% over the last 12 months.
Private rental prices paid by tenants in Great Britain rose by 1.8% in the 12 months to July 2017 – unchanged for the fourth consecutive month.
In England, private rental prices grew by 1.9%, Wales saw growth of 1.3% while Scotland saw rental prices increase by 0.2%.
London private rental prices grew by 1.5% in the 12 months to June 2017.
Rental prices for Great Britain excluding London increased by 2.0% in the 12 months to July 2017, also unchanged from June 2017.
Former Royal Institute of Chartered Surveyors residential chairman and now north London estate agent Jeremy Leaf said: “These figures are interesting because they don’t actually say very much.
“They show a fairly stable market at a time when we might have expected more nervousness among buyers and sellers.
“What we are seeing on the ground is a determination to get on with property transactions even if that means negotiating harder to make sure they go through.”
He added that he did not expect to see any significant changes in the near future.