Golf is on an upswing — just in time for the PGA Championship.

Sales of golf equipment grew by 8 percent to $2.5 billion in the 12 months ending in June, according to The NPD Group.

After several years of declines with major sports equipment retailers and manufacturers exiting the business, including the bankruptcy of specialty retailer Golfsmith, the sport had taken a licking.

Last year, sales declined by 6 percent as golfers scooped up huge deals when Sports Authority and Golfsmith liquidated.

“The retail closures and brands like Nike exiting golf made the industry more promotional and messy,” said NPD sports analyst Matt Powell.

As a growing number of baby boomers retire — and new stars like Jordan Spieth arise — golf as a hobby has taken on a new luster, he said.