* Hedge fund bought Dell, Xerox in fourth quarter
* Greenlight Capital LP fund gained 2.9 pct in 2011
(Puts First Solar in 1st paragraph, adds analyst comment, solar stock movements, exiting of Diamond Foods stake)
NEW YORK, Jan 18 (Reuters) - David Einhorn's Greenlight Capital covered its short position in U.S. solar company First Solar Inc (FSLR.O) in the fourth quarter, calling it "one of the most profitable shorts in the history" of the firm.
Helped by that success, the hedge fund manager told investors in a letter on Tuesday, Greenlight finished 2011 in the black, but "never has so much work gone into making 2 percent."
In a year when volatile markets whipsawed the hedge fund industry, Greenlight outperformed competitors, gaining 2.9 percent in its Greenlight Capital LP fund. Hedge funds, on average, fell about 5 percent last year.
Greenlight, which bets on stock prices rising and falling, added to its chest of brand-name technology stocks in the fourth quarter. It opened a new position in computer maker Dell Inc DELL.O and reopened a stake in Xerox Corp (XRX.N), the letter said.
The firm also sold out of one of its most successful bets ever, exiting its short position in First Solar, which fell 74 percent in 2011 and was the year's worst-performing stock in the Standard & Poor's 500 index.
First Solar shares were up 7.5 percent in afternoon trading following the news that Greenlight had closed its bet against the company. Other shares in the solar industry also rallied, with the MAC Global Solar Energy index .SUNIDX up 3.7 percent.
In addition to First Solar, big solar movers included JA Solar Holdings (JASO.O), Hanwha SolarOne HSOL.O, MEMC Electronic Materials Inc WFR.N, and Trina Solar (TSL.N).
Analysts said Einhorn's move on First Solar was part of a wider trend of short covering following a year in which most solar stocks lost 60 percent of their value or more.
"Towards the end of last year it was hard to find anyone who was long (solar), and when you get to that point the benefit of being short sort of diminishes," Mizuho Securities USA analyst Paul Clegg said. "Some of the big moves we have seen are more attributable to short covering than people taking big positions on the long side."
Greenlight also said it closed a small short position in nuts and snacks maker Diamond Foods Inc (DMND.O). Diamond shares were up 6 percent on Wednesday.
The hedge fund also exited significant long positions in the fourth quarter, including stakes in CVS Caremark Corp (CVS.N) and Employers Holdings Inc (EIG.N).
At the end of 2011, Greenlight's three biggest holdings were Apple Inc (AAPL.O), General Motors (GM.N) and gold.
(Reporting By Katya Wachtel in New York and Nichola Groom in Los Angeles; Editing by John Wallace and Steve Orlofsky)
((Katya.Wachtel@thomsonreuters.com; +1 646 223 6203)) Keywords: HEDGEFUND/EINHORN
(C) Reuters 2011 All rights reserved. Republication or redistribution of Reuters content, including by caching, framing, or similar means, is expressly prohibited without the prior written consent of Reuters. Reuters and the Reuters sphere logo are registered trademarks and trademarks of the Reuters group of companies around the world.