China and Taiwan reached agreement today on the return to Taiwan, via Hong Kong, of a cargo jet and two crew members flown to the mainland by a defecting pilot more than two weeks ago.

The agreement and the three days of negotiation leading up to it marked the first time that known direct talks on any matter have been held between China and Taiwan since the Chinese Communists drove the Nationalists from the mainland to Taiwan in 1949.

The agreement was reached after China backed down from its original position and agreed to return the plane and crew members to Hong Kong. The solution caused neither side to lose face and seemed to benefit both.

Political analysts said China benefited by getting Taiwan to engage for the first time in nearly four decades in direct negotiations with representatives from China and then by looking reasonable in the talks. This could create good will that would work in China's favor over the long run, they said.

Taiwan not only is to get its plane and two of the crew members back but also appeared to be more flexible and pragmatic than it has in the past.

On Tuesday, the two sides are to discuss details of the transfer, including when it will take place.

China earlier had insisted that Taiwan's national airline send a delegation to the southern Chinese city of Guangzhou to recover the 747 cargo jet. Taiwan considers Hong Kong to be more neutral ground than Guangzhou.

If Taiwan had agreed to go to Guangzhou, Taiwan would have been making a further departure from its longstanding policy of no contact with the Communists.

The pilot, Wang Xijue, flew to Guangzhou on May 3. Wang, who left his wife and children behind in Taiwan, said he wanted to be reunited with family members on the mainland. The other crew members have said they want to return to Taiwan.

At a press conference tonight, three representatives from Taiwan's airline, China Airlines, declined to describe the agreement as a victory for Taiwan, but they looked pleased.

Zhang Ruipu, manager of the Hong Kong office of the Civil Aviation Administration of China, said Peking agreed to deliver the plane and crew members in Hong Kong as a gesture of goodwill aimed at reuniting the crewmen with their families as soon as possible.

The move was made after a member of the Taiwan delegation was reported to have warned that the negotiations could break down if the mainland continued to insist on delivering the plane in Guangzhou. The Taiwanese had also begun to accuse the mainland side of prolonging the talks.

A dispatch today from China's official New China News Agency described the atmosphere at the airlines talks as "warm and friendly." The breakthrough came during a 50-minute meeting held in a conference room at the Hong Kong Jockey Club.

The negotiations seem to contribute to a further lessening of tensions between China and Taiwan and set a precedent for more talks should another incident occur, analysts said.

Political observers reached by telephone in Taiwan said the success of the Hong Kong negotiations was likely to strengthen the hand of younger and more moderate Nationalist officials who have been arguing for a policy of greater flexibility in dealing with China.