If you're talking about a street style down rail or box... Approach with a wide stance and speed, and then pop up. Don't worry about getting the spin around super fast, as it will come. In the air, spot your estimated landing area on the feature, and make sure to keep your knees bent. When you land, let your legs compress with the rail, locking yourself down. There ya got it!
Check out Andy doing it perfectly at 0:47 in this video.
Courtesy of Newschoolers.com