Citi has rated banking giant Barclays with a buy rating after its first half results revealed that second quarter underlying pre-tax profits came in ahead of expectations.For the three months ended 30 June, the lender reported an underlying pre-tax profit (excluding fair value of own debt and Payment Protection Insurance provisions) of £1.7bn. The figure beat consensus estimates of £1.5bn by 13%, and was 2% ahead of Citi's forecast of £1.6bn."This beat is however driven by a provision write-back in BarCap and UK retail. In contrast, 2Q11 pre-provision profit of £5.5bn is 6% light of consensus, due to weaker revenues (1% below) and heavier costs (2% heavy)," the US broker said.Citi labels the bank as 'medium risk', saying that its exposure to higher-risk banking activities (derivatives) is offset by its lower-risk activities (UK mortgage market).The broker sets its target price at 310p."There are several risks that could cause the share price to deviate significantly from our target price, including the risks of adverse regulatory changes, a significant UK economic double-dip recession, or a renewed bout of Eurozone sovereign concerns. If the impact of these risk factors is more/less negative than we anticipate, then the share price might fail to reach/rise above our target price."Barclays' shares were trading 0.97% higher at 219.1p at 15:55 on Tuesday.BC