RICHMOND, Va. – Advance Auto Parts said Wednesday that it is buying General Parts International for $2.04 billion in cash, which the companies say will create the biggest automotive replacement parts provider in North America.

As part of the transaction targeted to close by late 2013 or early 2014, Advance Auto will get 1,246 company operated stores and 1,418 independently owned Carquest locations. Its shares soared by $13.66, or 16.6 percent, to $96.16 on Wednesday.

The Roanoke, Va., seller of auto parts and batteries currently operates more than 4,015 stores in the United States, Puerto Rico and the Virgin Islands. General Parts is a privately held distributor and supplier of original equipment and aftermarket replacement products for commercial markets operating under the Carquest and Worldpac brands. The combined company will be based in Roanoke, Va., and continue to have a presence in Raleigh, N.C.

In January, the company acquired privately held Northeast car parts supplier B.W.P. Distributors, accelerating its growth in the Northeast.

Advance Auto also said Wednesday that it expects third-quarter earnings of $1.42 per share on revenue of $1.52 billion, compared with year-ago earnings of $1.21 per share on revenue of $1.46 billion.

Revenue at stores open for at least a year is expected to decrease by 2 percent. That’s an important measure for retailers because it excludes results from newly opened or closed stores.

When vehicle sales tumbled a few years ago, auto parts retailers such as Advance got a sales boost, as more Americans kept their vehicles longer and invested more in keeping them running.