The Sabatier reaction can be used to create methane from CO2 and H2 to be used as fuel for spaceships.
The hydrogen is combined with atmospheric CO2 to create methane and water. The chemical reaction is the following:
- CO2 + 4H2 → CH4 + 2H2O -165 kJ/mol
The Sabatier process would probably require electrolysis as a source of Hydrogen on Mars.