Utility stocks are an affordable way to gain exposure to the artificial intelligence trend and hedge against a slowing economy even after the sector’s recent rally, according to Goldman Sachs. Utilities have gained nearly 18% in the past three months to become the best performing sector in the S & P 500 in that period. The three-month return is one of the sector’s strongest performances in two decades, surpassed only by the rallies in 2003 and 2020, according to Goldman. Yet, utility stocks still remain relatively affordable. The sector has a price-to-earnings premium of just 6% compared to the equal-weight S & P 500, which is broadly in line with the historical median, according to the investment bank. “Despite the rally, utilities offer AI and defensive exposure at undemanding valuations,” analysts led by Ryan Hammond told clients in a Wednesday research note. The sector’s long-term growth prospects are improving due to rising electricity demand from data centers and AI, the analysts said. The utilities’ capital expenditure are expected to increase by roughly 36% over the next three years compared to the period from 2020 to 2023, according to the investment bank. Goldman is forecasting above consensus earnings growth of 2% on average in 2026 for the 16 utility stocks it covers. NextEra , Xcel Energy , Sempra and Southern Company offer the best exposure to the data center power demand surge among Goldman’s buy-rated stocks, according to the bank. Goldman also has buy ratings on American Electric Power Company , Eversource Energy , and FirstEnergy Corp . Utilities also offer a way to play defense against a slowing economy, according to Goldman. The investment bank expects the U.S. economy to grow 3.2% in the second quarter but then slow to 2% in subsequent quarters. “This environment, or a less-benign negative growth shock, would support owning defensive industries such as Utilities in the portfolio,” Goldman’s team of analysts said. Interest rates, however, are a potential headwind for the sector. Utilities typically underperform when bond yields rise: Higher rates raise borrowing costs for these companies, and they also make the stocks’ dividend yields look less attractive compared to the risk-free yields on Treasurys. The Federal Reserve, however, has indicated that interest hikes are not on the table, and Goldman’s rate strategists aren’t calling for higher yields. “However, a return to a rising bond yield environment could weigh on the performance of utilities,” the Goldman analysts said.