Quantum technology promises revolutionizing applications in information processing, communications, sensing, and modelling. However, efficient on-demand cooling of the functional quantum degrees of freedom remains a major challenge in many solid-state implementations, such as superconducting circuits. Here, we demonstrate direct cooling of a superconducting resonator mode using voltage-controllable quantum tunneling of electrons in a nanoscale refrigerator. This result is revealed by a decreased electron temperature at a resonator-coupled probe resistor, even when the electrons in the refrigerator itself are at an elevated temperature. Our conclusions are verified by control experiments and by a good quantitative agreement between a detailed theoretical model and the direct experimental observations in a broad range of operation voltages and phonon bath temperatures. In the future, the introduced refrigerator can be integrated with different quantum electric devices, potentially enhancing their performance. For the superconducting quantum computer, for example, it may provide an efficient way of initializing the quantum bits.