A civilian counterintelligence analyst for the Naval Investigative Service was arrested by the FBI on espionage charges yesterday for allegedly providing national defense secrets to a foreign government that sources identified as Israel.

Jonathan J. Pollard, 31, who lives near Dupont Circle in Washington, was arrested yesterday morning outside the Israeli Embassy in upper Northwest after he swerved around another car and sped through the gates of the closely guarded compound, according to sources familiar with the investigation.

A short time later, Israeli officials escorted Pollard outside the compound where he was arrested by waiting FBI agents who had been following him, sources said.

Pollard's wife Ann had accompanied him to the embassy compound in their 1980 Mustang, the sources said, but was not arrested.

Late yesterday, Pollard, a short, balding man described by a neighbor as a "Caspar Milquetoast," was ordered held in custody without bond after a federal prosecutor told U.S. Magistrate Patrick J. Attridge that the circumstances surrounding Pollard's arrest indicated he had "some intention to leave the country."

Assistant U.S. Attorney Harry R. Benner also said in court that Pollard had admitted having "a large amount of money" that the prosecutor said was payment for the secret documents he allegedly turned over to the foreign government. The magistrate scheduled a hearing for Wednesday to determine whether Pollard should continue to be held without bond.

Sources said that Pollard had told the FBI he passed what one source described as "highly sensitive" defense documents to Israeli officials, but it was unclear last night whether authorities had independently verified that the Israelis received any documents.

The FBI's announcement of the arrest and the complaint filed in court did not identify Israel as the foreign goverment involved. One of this country's closet allies, Israel annually receives more than $2 billion in military and economic aid from the U.S.

A secretary in the press office at the Israeli Embassy said yesterday: "The only thing I can tell you right now is that we're aware of the fact that someone was detained this morning in front of the embassy." She declined to comment further.

A U.S. official said last night that an official at the Israeli Embassy had been summoned to the State Department yesterday to discuss Pollard's arrest. The official did not characterize the nature of the discussions.

Pollard was charged with providing national defense secrets to a foreign government, which carries a maximum sentence of life in prison, and unauthorized possession of secret defense documents, which carries a maximum penalty of 10 years in prison and a $10,000 fine. There was no indication yesterday of the nature of the documents in question.

"I am not at liberty to disclose the nature of the documents," said U.S. Attorney Joseph E. diGenova, who attended yesterday's hearing. He also declined to say whether further arrests were anticipated.

An attorney for Pollard, Gordon Coffee, declined to comment after yesterday's hearing.

Pollard, who has lived in the Washington area for about five years, works in the Suitland office of the Naval Investigative Service (NIS), which is a law enforcement branch of the Navy charged with investigating criminal offenses. It was unclear last night how long Pollard had worked for the NIS.

Lt. Stephen Pietropaoli, a Navy press officer, said Pollard had been a civilian employe of the Navy for several years and began working for NIS in January. Other sources said he had begun working for NIS in October 1984, and a pretrial report, which is usually based primarily on an interview with the defendant, said that Pollard has worked for NIS for 18 months.

Pollard said in court that he was a graduate student in Boston before moving to the Washington area five years ago. He said he was born in Galveston, Tex., and grew up in South Bend, Ind.

Investigators for the Navy were alerted to Pollard's alleged espionage activities by fellow employes who became suspicious of his activities at work, according to sources. Sources said that earlier this week, Navy and FBI agents confronted Pollard with the allegations and he initially agreed to cooperate with the authorities.

In conversations with investigators this week, according to an FBI complaint filed in court, Pollard acknowledged that last Friday he supplied secret defense-related documents "to an agent of a foreign government." Sources said Pollard told investigators the goverment was Israel.

The FBI complaint further states that on Tuesday, investigators obtained a suitcase with Pollard's name on it that Pollard told them contained highly classified national defense documents. The suitcase had been given by Pollard's wife to an unidentified third party, according to the FBI complaint.

An informed source said the suitcase was given to the third party for safekeeping, and the person was not involved in the scheme and did not know what was in the suitcase. Before the suitcase was obtained by the agents, it was in the apartment building where Pollard lives at 1733 20th St. NW, according to the complaint.

Last night, Pollard's neighbors expressed amazement at his arrest as they gathered on the front steps of his four-story Dupont Circle apartment building just off Connecticut Avenue NW.

"He was the last person in the world you would expect to be a spy," said Tim Dane, 28, who manages the meat department at a nearby grocery store. "I thought he was an accountant, if anything."

Dane said Pollard drove a "beat-up" Mustang. Residents of the building where Pollard lives, said rents there ranged from $700 to $750.

Pollard was originally due to report to the FBI yesterday morning for an appointment, sources said. Instead, sources said, he drove to the Israeli Embassy compound near the intersection of Connecticut Avenue and Van Ness Street NW.