Shares of chipmaker Advanced Micro Devices Inc rose nearly 10 percent on Monday after Citigroup upgraded the company to a buy.

Citigroup analyst Glen Yeung said the upgrade was based on signs of a stronger AMD relationship with its main customer, Hewlett-Packard Co , expectations of a higher gross margin and a move by companies to replace aging PCs that could occur next year.

We recognize that AMD's competitive position is poor and its net debt position classifies the company as 'low quality,' he wrote in a research note. But he added, we see the risk/reward on AMD as favorable.

Gross margins suffered in the first half of 2009 as chip factories ran below capacity and AMD sought to clear inventory of older chips. But production levels are increasing due to the lower cost of newer, smaller chips.

We note that as sales increase 9 percent 2H09/1H09, we expect corporate gross margin to increase from 29.0 percent in 2Q to 38.6 percent in 3Q on higher utilization, Yeung wrote.

But Yeung warned the stock could stay weak if an uptick in back-to-school computer sales is not as strong as hoped, if shares are diluted due to AMD refinancing its 2012 debt, and as device manufacturers increasingly look to non-industry standard microchips as a lower-cost, lower-power way to run devices like netbooks.

AMD is the world's No. 2 maker of microprocessors, behind Intel Corp .

AMD's stock is up around 85 percent this year.

Shares in the Sunnyvale, California-based company rose 9.5 percent to $4.05 in early afternoon trading on the New York Stock Exchange.

(Reporting by Gabriel Madway and Clare Baldwin; Editing by Steve Orlofsky)