Image copyright EPA

The US economy grew at a faster pace than initially thought in the second quarter, according to revised figures.

The Commerce Department's second estimate for the April-June period put growth at an annualised 4.2%, slightly up from the previous figure of 4.1%.

It was the best quarterly figure for nearly four years and put the economy on track to hit Donald Trump's goal of 3% annual growth.

The figures helped send Wall Street to new highs on Wednesday.

The S&P 500 and the Nasdaq indexes both hit new record highs for the fourth consecutive session, boosted by gains for technology companies such as Amazon and Alphabet.

Amazon rose 3.4% as the online retailer edged closer to becoming the second US company after Apple to be worth $1 trillion. Its market value stands at $971bn.

Many economists had forecast a downward revision of growth to about 4%.

On a non-annualised basis, the economy grew 1% during the quarter. During the same period, the UK economy expanded by just 0.4%.

The upward revision reflected more business spending on software than previously estimated and less imports of oil.

Growth was driven by one-off factors such as a $1.5 trillion tax cut package, which helped boost consumer spending.

The new estimate was based on a more complete set of data than previously available and will be revised again next month.

US defence spending rose 6% in the quarter, the biggest increase in nine years. But there was also downward revisions to consumer spending and construction.

Economists questioned whether the US economy could maintain the same momentum.

"We expect the pace of the expansion will cool in the second half of 2018, as the boost from fiscal stimulus starts to fade ... and trade protectionism weighs on activity," said Oren Klachkin at Oxford Economics in New York.

The robust growth pace is likely to keep the Federal Reserve on course to raise interest rates next month for the third time this year.