Can I connect transmitter output to spectrum analyser input directly?
You can just connect the transmitter directly to the spectrum analyzer.

The spectrum analyzer can handle +30 dBm which is 1 Watt

Your +20 dBm is "only" 0.1 Watt

Also the DC voltage should not be an issue with regard to damaging the spectrum analyzer.

It depends on the spectrum analyzer if the DC voltage at the input causes the measured power to be off or not. If your transmitter's output normally does not carry any DC voltage then there is no need to do anything. If there is a DC voltage present I would add a DC blocker in series and check if that affects the measured power levels on the spectrum analyzer.

Realize that the spectrum analyzer needs at least some power to do its measurement, that power can go up to +30 dBm. You input no more than +20 dBm so that will be fine.