Confessed spy John Anthony Walker Jr. admitted today that he lied to the FBI about how he got started in espionage during an interview last summer.

"It was my intention to lie about that, and I did," Walker said during cross-examination by a defense lawyer for Jerry Alfred Whitworth, his former Navy colleague and best friend.

The July 2 interview at FBI offices in Baltimore was supposed to be about the participation of other people in the espionage ring, Walker said.

He said that at the interview, which took place four months before he pleaded guilty to espionage, he had not planned to discuss how he began spying.

"When they brought it up, I lied," Walker told defense lawyer James Larson. Responding to Larson's questions, Walker said the FBI questions on the subject came at the beginning of the July interview but that he did not seek to end that interview or consult with his lawyer.

"You just went ahead and lied, right?" Larson asked. "Yes," Walker replied.

In revealing the story Walker told the FBI in July, Whitworth's defense lawyers are not necessarily seeking to show that his later version is false, but rather that Walker is a person who will lie glibly and without compunction.

In the July interview, Walker said, he told the FBI that he began spying when he went to apply for a job at the Yellow Cab Co. in Norfolk and was told by two employes there that he could earn some money giving classified documents to a private intelligence-gathering organization.

Walker said today he did not remember the precise details of the story. "I don't remember, I was making it up as I went," he said.

In fact, Walker testified earlier and repeated today, he started spying simply by walking into the Soviet Embassy in Northwest Washington and offering to sell classified information.

Walker said today that at the start of that meeting he gave the Soviets the false name of "James Harper" until they insisted on learning his true identity.

Ironically, a man named James Harper pleaded guilty in April 1984 to selling classified documents about U.S. missile defenses to the Poles. U.S. Attorney William S. Farmer, who is prosecuting Whitworth, worked on the Harper case.

Walker is the star witness against Whitworth, a retired Navy communications expert who is charged with receiving $332,000 from Walker in return for passing classified Navy documents to the Soviet Union.

Although defense lawyers have said their case hinges on undermining Walker's credibility, they did not go on the attack against him today, the first full day of cross-examination, except to elicit the conflicting stories about the start of the spy ring.

In other testimony today, defense lawyers brought out additional details about what Walker passed to the Soviets.

Walker testified that he gave the Soviets copies of coding "key cards" used with the KWR-37 coding machine. The machine is the primary broadcast channel used to communicate with the submarine fleet, including submarines carrying ballistic missiles, as well as for broadcasts among surface ships and from ship to shore.

Walker said that at times he was giving the Soviets nearly "100 percent" of the codes, which change daily. He testified earlier that Whitworth later provided copies of the codes.

He said he also gave the Soviets copies of Navy messages about submarine war games and strategy.

Walker testified that his former wife, Barbara Joy Crowley Walker, discovered that he was spying when she found instructions from the Soviets by breaking into a locked desk with a screwdriver.

"It was a typical scene," John Walker said. "She was drunk as usual and near hysteria as usual . . . . It was always a scene with Barbara."

Barbara Walker, who has been given immunity from prosecution in order to testify against her former husband, tipped off the FBI to his activities in November 1984.