Gas or teething?

Occasionally our son will wake up crying in pain. We don't always know if it's gas or teething. How do you tell the difference?