It's not that easy to explain in words on a forum post, but here goes nothing ^^;
If the tree is low enough, just hold on the spacebar and move your char slightly until you're on the tree then release spacebar.
If tree is too high to do a normal jump; Walk right up against the tree untill your head is partially inside the tree then press "prt sc" and wait till you suddenly see yourself in the air and move your char forward just enough to land on the tree.
Please note not all tree's work like this, like palm trees.