Grab the side of a hat in a pinch grip, and carry it down in front of you so the crown is downwards. Flick it up so it spins 360 degrees, and catch it in another pinch grip at the back of the hat. Quickly push it up and forward, spinning the hat 180 degrees and catch in a pinch grip once again.
Stick it back on your head.
To perform the trick most effectively aim for one slick movement rather than two seperate parts.