Talgo beat out rival bids by Germany's Siemens and France's Alstom for the tender, which can be extended for a second batch of 15 more trains that would raise the total value of the contract to €1.4 billion.
"The winning offer was presented by Talgo," Public Works Minister Inigo de la Serna told a news conference in Madrid.
The company presented "the best offer from both the technical and economic point of view", he added.
The initial contract is to build 15 new high-speed trains and maintain them for 30 years. The construction of the trains will take around five years and generate around 1,000 jobs, the minister said.
Talgo is already the main supplier of high-speed trains to Spanish national rail operator Renfe, with 47 percent of the market, ahead of Siemens which has a 27 percent share and Alstom with 26 percent.
The new contract will give Talgo a 54 percent share of Renfe's high-speed train market, a Talgo spokesman told AFP.
Spain has Europe's biggest high-speed rail network, with over 3,000 kilometres (1,800 miles) of high-speed track.