The owner of the nation’s biggest provider of in-theater advertising, National CineMedia, is buying its scrappy rival, Screenvision, in a cash and stock deal valued at $375 million, the companies confirmed Monday.

Screenvision is owned by Shamrock Capital Advisors’ Growth Fund II, which paid $160 million in 2010 for a 61.2 percent stake.

Technicolor and Carmike Cinemas each own around 20 percent of Screenvision.

National CineMedia shares spiked 8 percent in after-hours trading, to $16.50 a share. Its shares are down 23 percent this year as sales are expected to slide .

The two firms combined will serve ads and trailers in almost all 210 local markets and work with 3,900 theaters, National CineMedia said.

Madison Avenue spent $678 million for ad spots on cinema screens in 2013 — up about 6.5 percent from the previous year, according to Cinema Advertising Council.

The firms said the deal would result in $30 million of annual operating synergies.

Screenvision’s owners will receive $225 million in cash and $150 million in National CineMedia stock.

National CineMedia’s first-quarter loss swelled to $3.1 million as sales fell 15 percent.