TOKYO—Japan’s economy picked up speed in the first three months of 2017, extending its most recent stretch of growth under Prime Minister Shinzo Abe to five quarters, the longest expansion in Japan since 2006.

Stronger global demand, especially for tech-related items, and an improvement in household spending helped gross domestic product beat forecasts and rise 2.2% on an annualized basis from the previous three months, according to preliminary figures released Thursday.

...