Yes. That's basically it. I'll give a little more detail.
This is the usual explanation for beginners on how PWM is generated. The top figure shows the signal we want to amplify. There is also high frequency triangular wave (sawtooth will work to). The frequency of the triangular wave is usually about ≥20x our highest signal frequency.
These 2 signals are fed into a comparator. The output of the comparator is shown in the middle figure. The pulses are coded as +1 when our input signal is greater than the triangular wave, and -1 when our input signal is less than the triangular wave. That is our PWM waveform. (Another method to generate a similar, but not the same, waveform is to use the sigma-delta modulator. The waveform is more correctly known as PDM instead of PWM.) There is no sampling or numerical computations involved in generating the PWM and the process can be done using analog circuits.
The pulses can now be used to drive power switching transistors to switch voltages and currents at much higher levels, and output much higher power pulses. The frequency spectrum of this PWM is shown in the bottom figure. We have out original signal, along with a lot of other byproducts that we don't want. However, the levels of those byproducts are high only when they are at around the switching frequency or higher. Therefore we can recover our desired amplified signal by filtering out the high frequency components of this high power PWM. Typical we use a cutoff frequency of about 1/10 the triangular wave frequency for this low pass filter.
View attachment 558395
For "digital" amplifiers, the PWM or PDM waveform is synthesized in the digital domain instead of using the above method.