The president appeared to be in good spirits throughout the evening and joked about a third term in office.