(Reuters) - Staples, the No. 1 U.S. office supplies retailer, agreed to buy No. 2 Office Depot in a $6.3 billion deal designed to help it better compete against Wal-Mart Stores and online rivals such as Amazon.

The deal, which will likely come under close scrutiny from antitrust regulators, values Office Depot at $11 per share, based on Staples' closing price on Feb. 2, the last trading day prior to media reports that a deal was near.

Office Depot's shares were trading at $9.93 before the opening bell on Wednesday, up about 7 percent.

Staples' shares were down 1.5 percent at $18.72.

Staples and Office Depot are the biggest remaining U.S. retailers of basic office supplies such as paper and ink toner.

Regulators rejected Staples' attempt to buy Office Depot in 1997, citing antitrust concerns. But antitrust experts have said a deal could pass muster this time because of an increase in the number of retailers offering the same products.

Nevertheless, Staples said it could call off the deal if authorities ordered divestitures that delivered more than $1.25 billion of Office Depot's 2014 U.S. revenue.

The Federal Trade Commission, the U.S. antitrust watchdog, did not require Office Depot to ditch stores when it bought Office Max in 2013, citing increased competition in the sector.

Online retailers such as such as Amazon.com and big-box chains such as Wal-Mart have taken a big chunk of the market for office supplies, in part by offering cheaper prices.

Activist investor Starboard Value LP called for the companies to merge last month, saying this would lead to greater cost savings.

Starboard had a 5.1 percent stake in Staples as of December and boosted its holding in Office Depot to nearly 10 percent the same month.

Staples said it expected to generate at least $1 billion of annualized cost synergies by the third year after the deal closes.

Staples, which said on Wednesday that it began talks to buy Office Depot in September, will pay $7.25 per share in cash and 0.2188 of its shares for each Office Depot share, a premium of 44 percent to Office Depot's close on Monday.

Staples said it would pay a $250 million termination fee if the deal is scrapped.

Barclays is financial adviser to Staples. Legal advisers are Wilmer Cutler Pickering Hale and Dorr and Weil, Gotshal & Manges. Peter J. Solomon is financial adviser to Office Depot, whose legal adviser is Simpson Thacher & Bartlett.

(Editing by Savio D'Souza and Ted Kerr)