NEW YORK (AP) _ Wayne Gretzky, the NHL's all-time leading scorer, has agreed to a contract extension with the New York Rangers that will allow him to finish his career with the team, according to newspaper reports.

The deal was to be announced today at Madison Square Garden.

The New York Post and Daily News reported Thursday that Gretzky's contract extension will keep him with the Rangers at least two more seasons. The News said he will earn about $6.5 million this season and $5 million in 1988-89.

If Gretzky decides to continue playing after that, the Rangers would have the option of keeping him, both papers said.

Gretzky's original two-year contract with the Rangers was scheduled to expire after this season. He previously played for the Edmonton Oilers, Los Angeles Kings and St. Louis Blues.

Entering his 19th NHL season, Gretzky has a record 862 goals, 1,843 assists and 2,705 points. The Rangers open their season Friday night against the New York Islanders.