According to the Star Wars: Incredible Cross-Sections factbook, the T-65 X-Wing fighter utilises "differential thrust" from its four powerful "Fusial Ion Engines", "High-mass electromagnetic gyroscopes" as well as forward facing "retro-thrusters" to create a combination of thrust, pitch, yaw and roll.
Since this is largely reliant on negating the effects of forward thrust, it also goes some way to explaining why the ship handles like a dogfighting jet even though it's in space and should, theoretically, be able to freely rotate.
In the new trilogy (according to Star Wars: The Force Awakens Incredible Cross Sections) the T-70 X-Wing has many of the same features as well as a new refinement, wing-mounted repulsors which, presumably are intended to provide additional maneuverability within a planet's atmosphere.
There's also a nice bit in the Star Wars: Blueprints - Rebel Edition that shows the interior workings of the engines and how they achieve variable thrust vectoring.
As to your (sub-)question of how the ship gets into space in the first place, the answer is that it uses its "Repulsorlift engines" for both lift and vectoring until it's clear of the landing pad and can turn on its main engines.