I'd like to create a game where a car drives over a 2D terrain. Which algorithm to use so the car will follow the mountain incline?
The game you linked to in your comment most likely uses a physics-engine like Box2D (flash port) for the car physics. So the basic steps are: Create a car body with connected wheels (use joints) and use either a procedural approach or a level editor to create the terrain.
The car following the terrain will be handled by the physics-engine if you set things up correctly.