On June 15, 2020, BP logos can be seen at a BP petrol/diesel filling station southeast London.LONDON BP, the oil and gas giant, beat earnings expectations for its second quarter on Tuesday. BP also increased its dividend and buyback program.U.K.-based energy giant said it would buy back $1.4billion of its shares in the third quarter, citing a $2.4billion cash surplus in the first half. The dividend was also increased by 4% to 5.46c per share. It had been halved to 5.25c per share in 2020's second quarter.Based on an average oil price of $60/barrel, it also expects buybacks in the range of $1 billion per quarter.Full-year underlying replacement costs profit of $2.8 billion was posted by the energy major. This proxy for net profit is used to measure it. This is compared to a loss in the same period one year ago of $6.7 billion and a net profit of $2.6 billion for the first quarter 2021.Refinitiv polled analysts and found that they expected a second-quarter net profit in excess of $2.06 trillion."This is a sign that we continue to perform while transforming BP generating wealth for our shareholders today and transitioning the company for future," CEO Bernard Looney stated in the earnings statement.These results are indicative of a wider trend in the oil and gas industry, as major energy companies seek to reassure investors that they have gained more stability amid the ongoing coronavirus epidemic. Last week, the British-Dutch multinational Royal Dutch Shell and France's TotalEnergies announced share buyback programs.The share prices of the largest oil and gas companies in the world aren't yet reflecting the increase in earnings. However, the industry faces many uncertainties and continues to face challenges.BP shares are up nearly 15% year-to date, after having fallen roughly 47% in 2020.At the end of the second-quarter, operating cash flow was $5.4 billion. This includes an annual payment of $1.2 billion for the Gulf of Mexico oil spillage in 2010.Net debt dropped to $32.7 billion, down from $33.3 billion during the first quarter. This is the fifth consecutive quarter with a decrease in debt compared to the $51 billion recorded in the first half of 2020.One year after the company's strategic restructuring announcement, which was made in August 2020, it highlighted that it had constructed a 21-gigawatt renewable energy pipe and brought eight major oil & gas projects online.Increasing commodity pricesBP's financial results are the result of a period with higher commodity prices. Brent crude oil futures, an international benchmark, rose to an average $69 per barrel in the second quarter. This is an increase from $61 in three months earlier.Oil prices have recovered to multi-year highs in the recent months. All three major forecasting agencies in the world, OPEC, International Energy Agency and U.S. Energy Information Administration, now anticipate a demand-led recovery picking up speed in second half of this year.It follows a period of 12 months that BP described as "an extraordinary year" for global energy markets.BP published its benchmark Statistical Review of World Energy on July 8 and stated that it had witnessed some of the most significant episodes in the history of global energy systems. These crises include the 1956 Suez Canal Crisis, 1973 oil embargo, 1979 Iranian Revolution, and 2011 Fukushima catastrophe.Spencer Dale, chief economist for BP, stated in the report that "all moments of great turmoil within global energy" All of these events pale in comparison with the last year's.In 2020, the ongoing Covid-19 crisis caused a massive oil demand shock. Big Oil companies were subject to a brutal 12 month by almost every measure. The pandemic was accompanied by falling commodity prices, shrinking profits, unprecedented write downs, and thousands of job losses.CNBC was told by analysts that, while energy companies are likely to present a clean bill-of-health, investors should be skeptical about the long-term business plans of oil and gas companies. This was mainly due to the growing climate crisis and the urgent need for fossil fuels to be phased out.