Yup!
From the US Department of Energy:
"Heat pumps offer an energy-efficient alternative to furnaces and air conditioners for all climates. Like your refrigerator, heat pumps use electricity to transfer heat from a cool space to a warm space, making the cool space cooler and the warm space warmer. During the heating season, heat pumps move heat from the cool outdoors into your warm house. During the cooling season, heat pumps move heat from your house into the outdoors. Because they transfer heat rather than generate heat, heat pumps can efficiently provide comfortable temperatures for your home"
Further:
"Some high-efficiency heat pumps are equipped with a desuperheater, which recovers waste heat from the heat pump's cooling mode and uses it to heat water. A desuperheater-equipped heat pump can heat water 2 to 3 times more efficiently than an ordinary electric water heater."
https://www.energy.gov/energysaver/heat-pump-systems