Japan's economy expanded by a faster-than-expected annualized 3.1% in April-June, data showed on Thursday, rebounding from the previous quarter thanks to a solid pick up in consumption.

The data backs up the Bank of Japan's forecast that a solid economic recovery will help inflation sustainably hit its 2% target, and justify raising interest rates further.

The increase in gross domestic product (GDP) compared with a median market forecast for a 2.1% gain, and followed a revised 2.3% slump in the first quarter, government data showed. The reading translates into a quarterly rise of 0.8%, beating a 0.5% increase expected by economists in the Reuters' poll.

Private consumption has been a soft spot in the economy as households struggle with rising living costs, blamed in part on higher import prices due to the weak yen.

Private consumption, which accounts for more than half of the economic output, rose 1.0%, compared with forecast for a 0.5% increase and the first gain in five quarters.

Capital spending, a key driver of private demand-led growth, rose 0.9% in the second quarter, versus an increase of 0.9% seen by economists in Reuters' poll.

External demand, or exports minus imports, knocked 0.1 point off growth, the data showed.

The BOJ raised interest rates last month and detailed a plan to taper its huge bond buying in another step toward phasing out its massive monetary stimulus.