He served as the head (dyak) of the foreign ministry (Posolsky prikaz) from 1671 to 1676 during the reign of Alexis of Russia,[3][4] succeeding Afanasy Ordin-Nashchokin.
[6][7] At the end of the year Matveyev was raised to the rank of okolnichy, and on 1 September 1674 attained the still higher dignity of boyar.
The deplorable physical condition of Alexius's immediate successor, Feodor III, suggested to Matveyev the desirability of elevating to the throne the sturdy little tsarevich Peter, then in his fourth year.
He purchased the allegiance of the Streltsy and then, summoning the boyars of the council, earnestly represented to them that Feodor was unable to reign and urged the substitution of little Peter.
He organized a publishing house on the premises of the Posolsky Prikaz and compiled the so-called Tsarsky titulyarnik (Царский титулярник), an illustrated reference book about titles of the Russian tsar and foreign rulers, with some information on Russian history, pictures of different coats of arms, stamps, monarchs and patriarchs.
Matveyev was the one to introduce theater to the court by organizing a group of actors guided by George Hüfner who staged various plays.