A key agreement to reopen a regional railway line has been signed by the Government.