A geothermal system is used for obtaining heated heat transfer fluid, such as steam, via heat transfer with an underground reservoir of magma. The geothermal system includes a wellbore extending between a surface and into an underground chamber formed in a reservoir of magma. The chamber may be formed by injecting a fluid at an increased pressure into underground magma to form a cavity that acts as the underground chamber.