Feed a speaker only with positive voltages
The 0-3.3V signal has a 1.65V DC component, and this will effectively be shorted by the speaker. You should not connect the speaker directly to the microcontroller as the speaker presents a very low impedance at DC (assuming a regular moving magnet speaker with a voice coil), and it will essentially short the microcontroller.

To ensure that DC voltages do not reach the speaker, put the speaker in series with a capacitor. With a capacitor, you need not worry about the microcontroller driving 3.3V, the capacitor will block DC voltages. You should also ensure that your microcontroller's output pin has sufficient current handling capabilities to drive the speaker directly; buffering the output pin with a MOSFET would be a good idea, or you could get more sophisticated and add an amplification stage with high-pass filter to remove the DC component.

If you have a higher impedance speaker (more of a buzzer), then driving it directly may be perfectly fine. You simply need to find the DC impedance of the speaker, and verify that the current draw is within the limits of the microcontroller GPIO driver.