* Top Republican lawmaker optimistic on averting fiscal crisis
* Costco to pay special dividend ahead of expected higher taxes
* Getco, Virtu make rival bids for Knight Capital
* Dow, S&P 500, Nasdaq each end up 0.8 pct
NEW YORK, Nov 28 (Reuters) - U.S. stocks rallied on Wednesday after comments from House Speaker John Boehner, the top Republican in Congress, on a possible compromise to avoid the "fiscal cliff" turned the market around.
The S&P 500 rebounded from a 1 percent decline, gaining more than 20 points from its low after Boehner, an Ohio Republican, said he was optimistic that a budget deal to avoid big spending cuts and tax hikes can be worked out. President Barack Obama added to the good feelings, saying he hoped to get a deal done in the next four weeks.
Whether or not those remarks reflect the reality of negotiations is another story.
"The fiscal cliff is dominating the discussion, and short term, we're a little bit too optimistic on it being fixed right away," said John Manley, chief equity strategist for Wells Fargo Advantage Funds in New York.
In expectation of higher dividend tax rates in 2013, companies have been shifting dividends or announcing special payouts to shareholders.
Costco Wholesale Corp, up 6.3 percent at $102.58, was the S&P 500's biggest percentage gainer after it became the latest company to announce a special dividend.
The market's move marked the second straight day where a leading legislator dictated trading action. On Tuesday, stocks fell on pessimistic remarks from Senate Majority Leader Harry Reid, a Democrat from Nevada.
The market has been swinging for weeks now on headlines from Washington, with Wednesday's gyrations once again highlighting the importance that Wall Street is giving to finding a solution to avoid the series of tax increases and spending cuts that could push the U.S. economy into recession.
The Dow Jones industrial average rose 106.98 points, or 0.83 percent, to 12,985.11 at the close. The S&P 500 gained 10.99 points, or 0.79 percent, to 1,409.93. The Nasdaq Composite added 23.99 points, or 0.81 percent, to close at 2,991.78.
The S&P 500 bounced off a strong support area near 1,385 that includes both its 200- and 14-day moving averages. It closed above 1,400 for the third session in four - an optimistic sign for stock bulls.
Knight Capital Group Inc shares jumped 15.2 percent to $3.42 on news that Getco Holding proposed a $1.4 billion merger with Knight, while Virtu Financial offered to buy Knight for at least $1.1 billion.
Apparel retailer Express Inc rose 8.9 percent to $14.15 after it forecast strong earnings for the current quarter as lower prices and easy-to-understand discounts led to robust Black Friday sales.
The S&P retail index gained 1.4 percent.
Green Mountain Coffee Roasters surged 27.3 percent to $36.86 a day after it forecast quarterly and full-year earnings well ahead of analysts' expectations.
Nearly 6.1 billion shares changed hands on the New York Stock Exchange, the Nasdaq and NYSE MKT, below the daily average so far this year of about 6.48 billion shares.
On the NYSE, roughly seven stocks rose for every three that fell, and on Nasdaq, five issues rose for every three that fell.