That was more than double the pace recorded in the previous three months, and above estimates of 2.2%.
The rise, helped by an increase in exports, is a further sign that the economy may be getting back on track.
The government had originally estimated that GDP grew at a 1.7% rate in the second quarter.
The revised non-annualized quarter on quarter figure was 0.6%, up from an initial 0.4% estimate.
Housing and business investment, two key sectors of the economy, remained strong in the revised figures.
Housing construction grew at an annual rate of 12.9%, the fourth consecutive quarter of double-digit growth.
Meanwhile, business investment was revised up to a 16.1% rate.
The government also said data from retailers showed they had restocked their shelves at a faster pace in the April-to-June period than first thought.
The positive news could make US central bank economists more likely to begin reducing monthly bond purchases later this year.
The programme is one of the US’s last stimulus measures.
Economists think growth will stay at the 2.5% rate in the second half of the year, boosted by steady job gains and less drag from federal spending cuts.
mjd75N1OpYAImage source: Wikimedia Commons President-elect Donald Trump celebrated his election victory at the Ultimate Fighting…
Millions of voters across the US chose to return Donald Trump to the White House…
Donald Trump declares victory in the US election as he addresses jubilant supporters in Florida.…
Stocks around the world are rising as Donald Trump appears to be on the cusp…
Donald Trump has won Pennsylvania, North Carolina and Georgia and taken a lead over Kamala…
Quincy Jones, the celebrated musician and producer who worked with Michael Jackson, Frank Sinatra, Ray…