Gold neared two-month highs on Tuesday as escalating violence in Libya and unrest spreading across the Middle East outweighed optimism over stronger U.S. economic data, while silver hit fresh 31-year peaks.

The gold price has risen by nearly 8 percent since uprisings in Tunisia and Egypt unleashed a swathe of popular protests across the region, sending the oil price to 2-1/2-year highs and raising concern among investors of the potential impact of soaring energy prices on growth.

Tensions in the volatile region worsened as forces loyal to Libyan leader Muammar Gaddafi massed near the Tunisian border on Tuesday, while the United States said it was moving warships and aircraft closer to Libya.

Spot gold rose to a session peak at $1,421.35 an ounce and was up 0.6 percent at $1,419.66 an ounce by 1240 GMT. It rose 6 percent in February, its largest monthly rise since August, when the U.S. Federal Reserve first indicated that it would continue the massive money printing by monetizing government bonds.

We were looking for a correction in gold in January, and certainly I think that correction was interrupted by the political situation in North Africa and the Middle East, and that has been responsible for getting gold back up to $1,400, said Deutsche Bank analyst Daniel Brebner.

While the uncertainty over the region is proving beneficial for gold for now, Fed Chairman Ben Bernanke's twice-yearly testimony to the U.S. Senate Banking Committee later in the day could be more decisive in determining the outlook for the gold price, he said.

The market may look at Bernanke's discussion today to get guidance in terms of where the next move will be. If it is to remain accommodative, then that's very good for gold. If the Fed ... talks about a hiking cycle or rising interest rates, then that may temper enthusiasm.

U.S. April gold futures were up 0.3 percent at $1,414.70.

FED IS KEY MARKET MANIPULATOR

Since the Fed cut rates to 0.25 percent in response to the global financial crisis in late 2008, the gold price has risen 70 percent, reaching a record $1,430.95 in December 2010.

A low rate environment encourages investors to buy gold as it limits the opportunity cost, or premium relinquished for holding a non-yield bearing asset, of owning the metal.

Soaring food and energy prices have ignited inflation in emerging economies and have begun to raise consumer prices in the developed world, which raises the likelihood of tighter monetary policy, usually a negative for gold.

There's conflicting signals out there, which is beneficial for gold. But I wouldn't say there's a clear direction at the moment. The pendulum has swung back from (investors) being optimistic about economic recovery to being somewhat more cautious, said Simon Weeks, head of precious metals at Bank of Nova Scotia.

In a reflection of investor ambiguity on gold, holdings of the metal dropped in the SPDR Gold Trust, the world's largest gold-back exchange-traded fund.

Holdings fell for a fifth consecutive month in February, marking their worst string of declines since the creation of the fund in 2004.

Offsetting some of the potential negative impact from sustained ETF outflows was the largest rise in speculative holdings of gold futures on COMEX in February since August last year.

The Australian Bureau of Agricultural and Resource Economics and Sciences (ABARES) said gold prices could drop 20 percent later this year and in 2012 as the global economy picks up and speculators exit the market.

Adding to some of the concern about inflation, Brent crude oil futures rose above $112 a barrel on Tuesday as the ongoing unrest in the Middle East and North America threatened to further reduce crude supplies.

Silver hit fresh 31-year highs at $34.46 an ounce at 1258 GMT, showing a 1.95 percent gain on the day. Silver has risen nearly 11 percent this year, shrugging off the prospect of rising supply as industrial demand improves.

Top primary producer Fresnillo (FRES.L) said it expects a 5 percent rise in silver output in 2011 to around 44 million ounces, while U.S.-listed Coeur d'Alene Mines (CDE.N) said on Monday it expected production to rise 20 percent to 20 million ounces this year.

Platinum was up 0.7 percent at $1,817.50 an ounce, while palladium was up 1.5 percent at $804.97.