Lockheed Martin Corp has been awarded a preliminary contract valued at up to $3.68 billion to build 31 additional F-35 fighter jets for the U.S. military, the Defense Department said on Friday.

Details of the agreement will be worked out between the two sides in 2013, said Joe DellaVedova, spokesman for the Pentagon's F-35 program office.

Lockheed also won additional contracts valued at up to $1.2 billion for spares and sustainment of the F-35 Joint Strike Fighter program.

The Pentagon plans to spend $396 billion to buy a total of 2,443 F-35 fighter jets from Lockheed over the next decades, making the Joint Strike Fighter the costliest weapons program in U.S. history.

(Reporting By Andrea Shalal-Esa; Editing by Leslie Adler)