* Best quarterly performance since Q1 2011
* Uncertainty remain over China stockpiling, farmers' sowing plans (Updating throughout)
NEW YORK Dec 31 (Reuters) - Cotton edged slightly higher on Monday but finished 2012 down 17 percent on the year, posting the third-biggest annual decline among commodities, as the market struggled with oversupply and sluggish demand.
Even so, fibers rose 8.6 percent in the fourth quarter in a late year-end rally as speculative investors bet on higher prices amid hopes for more buying in 2013 from China, the world's largest consumer and producer, and expectations that farmers will plant less cotton in the spring in favor of higher-priced grains.
It was the biggest quarterly gain for cotton prices since the first quarter of 2011.
On Monday, benchmark U.S. cotton futures rose 0.48 cent, or 0.64 percent, to settle at 75.14 cents per lb.
Cotton's 17 percent annual decline was the third-steepest slide among the 19 commodities tracked by the Thomson Reuters-Jefferies CRB index, after arabica coffee futures and U.S. orange juice futures..
Cotton also fell more than 36 percent in 2011. An earlier rally to lofty price levels had boosted sowing and decimated demand, while a shaky global economy scared off investors.
This year, the U.S. government forecast a record surplus of just under 80 million 480-lb bales by the end of the 2012/13 season to end-July 2013.
Cotton enters the new year with questions over China's policy towards stockpiling and forecasts that farmers will grow more wheat and soybeans, which posted the biggest price gains among commodities in 2012 as the worst drought in more than half a century hit the U.S. corn belt.
Analysts said many farmers will find it profitable to switch to grains from cotton.
With only U.S. cotton deliverable on the ICE exchange, a severe cut in sowing by farmers in the world's third-largest producer could have a significant impact on futures even if there is an excess in the rest of the world. (Reporting By Josephine Mason; Editing by David Gregorio)