Peet’s Coffee & Tea said Tuesday it reached an agreement to buy Stumptown Coffee Roasters, a deal that could give Peet’s a bigger footprint in the premium coffee market.

Stumptown’s majority owner, private-equity firm TSG Consumer Partners LLC, had been working on a potential sale of the Portland, Ore.-based roaster and retailer, The Wall Street Journal reported in May.

TSG...