The BSE Sensex ended higher on Monday, recovering from early losses, after data showed headline inflation in December slowed to a two-year low, even as a slew of sovereign rating downgrades in Europe dampened risk appetite globally.

The main 30-share index ended 0.22 percent higher at 16,189.36 points, with half of its components in the green. The index fell as much as 0.7 percent in early trade.

We had fallen in line with the weak global markets in the morning, but the trend of the Indian markets is basically positive, said S.P. Tulsian, an independent analyst in Mumbai.

In our markets there is some positive sentiment. People are confident that after the elections in Uttar Pradesh the government will be very active (with reforms), he said.

Elections in the key Indian state of Uttar Pradesh are due in February.

Last week, India formally lifted restrictions on foreign investment in its single-brand retail sector. The government is also considering allowing foreign airlines to invest in its hard-pressed airline sector.

The wholesale price index, the main inflation gauge, rose 7.47 percent from a year earlier, slowing from a 9.11 percent rise in November, roughly in line with the 7.50 percent increase forecast in a Reuters poll.

Headline inflation in December slowed mainly because of a fall in food prices, Finance Minister Pranab Mukherjee said, adding that manufacturing inflation, which has declined only marginally, was still a cause of concern.

Post inflation the stocks had stopped falling. It is a little bit surprising because the inflation numbers were as per expectations and the street had to contend with the sovereign downgrades in Europe, said P. Phani Sekhar, a fund manager at Angel Broking.

Traders said slowing inflation could pave the way for India's central bank, which meets on January 24 to review policy, to gradually start easing monetary policy after two years of tightening.

Tata Motors pared early losses and rose 2.37 percent after research house Jefferies raised its target price to 244 rupees from 206 rupees and said the automobile major would be one of the few stocks likely to see upgrades in the near term.

Maruti Suzuki, India's top carmaker, rose 3.17 percent after Macquarie upgraded the stock to outperform from underperform, saying it expected a gradual improvement in sales growth and profitability in 2012.

The 50-share NSE index ended up 0.16 percent at 4,873.9 points. In the broader market, losers slightly outpaced gainers in a ratio of 789 to 668 on total volume of about 628 million shares.

The major trends or forces are slightly positive. I think we can see the Nifty moving towards 4,900-4,930, said Alex Mathews, head of research at Geojit BNP Paribas Financial Services.

We are all waiting for some big numbers to come out this week, he said.

Software services companies Tata Consultancy Services and Wipro Ltd rose 2.18 percent and 1.6 percent, ahead of their results later this week.

TCS is expected to report a 23.1 percent rise in quarterly net profit on Tuesday, while Wipro's net profit may rise 12.3 percent a Reuters poll of brokerages show.

Euro zone bank shares fell but stocks seen as resilient to an economic slowdown gained on Monday in the wake of Standard and Poor's mass downgrade of euro zone sovereign ratings, while the euro hovered near 17-month lows against the dollar.

STOCKS ON THE MOVE

* Shares of Jubilant Industries rose 7 percent after the company reported a 136 percent jump in consolidated net profit to 160 million rupees for the quarter ended December 2011.

* Shares of cable operators Hathway Cables and Den Networks jumped 11.3 percent 6.5 percent, respectively, after the Business Standard newspaper reported Reliance Industries Ltd had approached the companies to buy a minimum of 26 percent stake in them.

In a statement issued later on Monday, Hathway Cable said Reliance had not approached the company.

* Shares of IT company CMC rose 2.2 percent after the company's consolidated net profit in October-December rose 26.8 percent quarter on quarter to 413.7 million rupees.