Volkswagen's Spanish unit has signed a new contract with most of its workers to end an industrial dispute which began last March.