The match comes amid moves by the United States to normalise relations with Havana after diplomatic ties were severed 54 years ago.
The match was announced in a press conference on Monday.
New York Cosmos, which reformed in 2013 and plays in the North American Soccer League, has former Spain striker Raul on its books and is expected to be a big draw for the growing number of football fans in Cuba - traditionally a baseball-mad country.
"Our big intention for this trip is to bring people together through soccer," said Cosmos head coach Giovanni Savarese.
Cuba coach Walter Benitez added: "I'm excited to be part of this match; to be playing against a big club like the New York Cosmos and big players like Raul."
The last US sports team to play in Cuba was baseball's Baltimore Orioles, which beat the Cuban national team 3-2 in 1999.