A global wave of investment in high-capacity batteries is poised to transform the market for renewable energy in coming years, making it more practical and affordable to store wind and solar power and deploy it when needed.

Government-owned utilities and companies are buying batteries that can be larger than shipping containers. A configuration of Tesla Inc.’s new utility-scale batteries can hold enough energy to power every home in San Francisco for six hours. Battery makers also are working on more advanced models that will...