By James Herron Of DOW JONES NEWSWIRES LONDON (Dow Jones)--BP PLC (BP) Tuesday posted a $17.15 billion loss for the second quarter as it made provision for $32.2 billion dollars in costs related to the Gulf of Mexico oil spill. BP also announced that Chief Executive Tony Hayward will step down on October 1, to be replaced by Robert Dudley, the executive director currently heading up the company's oil spill response. The huge loss compares with a net profit of $4.39 billion in the second quarter of 2009. Excluding the cost of the oil spill, BP's underlying performance was strong. Its clean replacement cost of supplies, a keenly-watched figure that strips out gains or losses from inventories and exceptional items like the spill costs, rose almost 70% in the second quarter to $4.98 billion, from $2.94 billion in the same period a year earlier. This was just under expectations of $5.03 billion in a Dow Jones Newswires poll of 9 analysts. BP shares closed at 417 pence Monday, up almost 38% from the 14-year low hit on June 29. Company website: http://www.bp.com -By James Herron, Dow Jones Newswires; +44 (0)20 7842 9317; james.herron@dowjones.com (END) Dow Jones Newswires July 27, 2010 02:17 ET (06:17 GMT)