The veteran defensive midfielder has signed a three year deal taking him to 2023.
It ends speculation about his future, as he was expected to leave in the summer earlier this season. But Solskjaer is happy that he can count on Matic.
He said in a statement: "I am delighted that Nemanja has signed a new contract, I know his experience, professionalism and leadership will be invaluable to this young talented group.
"We have great strength in midfield and Nemanja's attributes are a key part of that.
"Nemanja has been here for three seasons now and really understands the values of playing for Manchester United.
"He remains hugely ambitious and determined which will be vital as we look to achieve our aims over the coming years."