Several anti-Israeli demonstrations are planned during the best-of-five series, which will be played March 6-8 at the 4,000-seat Baltic Hall.
Malmo officials announced the decision after a vote on the issue in the city's recreational committee. The Swedish Social Democratic Party and the Left Party won the vote 5-4 after a long debate.
The recreational committee said it could not guarantee security for the fans.
"It's a high-risk match," committee chairman Bengt Forsberg was quoted as saying by Swedish news agency TT.
Only officials, some sponsors and journalists will be allowed to enter the arena.
Carlos Gonzales Ramos, the committee's vice chairman, wanted to call off the match.
"But since it was not possible to do so, this was best result," he told TT.
This will be the second time a Davis Cup match will be played in an empty arena in Sweden. In 1975, two years after a military coup led by Augusto Pinochet against the elected Chilean government of Salvador Allende, Sweden played Chile in Bastad and no spectators were allowed.
The Malmo decision came after Israeli player Shahar Peer was denied a visa to play in this week's Dubai Tennis Championships.
Michael Klein, chairman of the Israel Tennis Federation, said it was a shame that political demonstrators could force Sweden to keep out fans.
"This means that they will not sell tickets to the general public because they are expecting provocation by troublemakers who have nothing to do with the sport," he said. "It's terrible that they are trying to mix politics with sports, especially in an enlightened country like Sweden.
"I trust the Swedes to hold the game in the spirit of sports and not politics. It is not them but a group of troublemakers who want to get attention who are doing this."