Climate change in the upcoming decades will affect solar resources and impact photovoltaic (PV) energy generation, which is key for the global energy transition. The climate-change associated costs for future solar plants need to be assessed, considering different climate futures and PV technologies. Here we show PV power potential increases up to 6% (12% at the end of century) in Europe, eastern America, and south Asia, while reductions predominate in the rest of the world. While temperature and radiation changes dominate the PV changes, atmospheric aerosols also play an important role in future PV production, which has not been thoroughly evaluated before. In future high-emission scenarios, the best outcomes are achieved with thin-film modules that are more resilient to a warmer climate, highlighting the importance of improving thermal management in market-dominant silicon solar cells. In a future low-emissions scenario, the climate impacts on PV and the associated costs are the lowest, potentially saving up to 12 billion US$/year.