Dani Pedrosa will join KTM as a test rider in 2019, as the 31-time MotoGP race winner has signed a two-year deal with the Austrian brand.
Pedrosa will retire from MotoGP racing after spending 13 years in the category.
The 33-year-old is currently enduring his worst campaign in the premier class to date as he is only 11th in the standings with three rounds remaining.
Despite spending his entire grand prix racing career with Honda, Pedrosa will switch to rival manufacturer KTM and join the squad's existing third rider Mika Kallio.
KTM is in its second season in MotoGP but the team has struggled to build on its rapid rookie season with further progress in 2018.
Pedrosa becomes the brand's second significant signing for 2019, as Johann Zarco will join the race team to partner Pol Espargaro next year.
"To have a rider of Dani's skill and experience as part of our MotoGP project is another strong sign that we are moving in the right direction and we are still pushing as hard as we can," said KTM motorsports director Pit Beirer.
"We have seen how competitive MotoGP is this year and how fractions of a second can sometimes hide real progress and valuable lessons.
"We hope - and we are very excited - that Dani's input alongside Mika Kallio and feeding into the two teams we'll have on the grid next year will really help to close the gap even further.
"We can feel very optimistic about our possibilities for the upcoming seasons. I'd like to thank the whole crew at the factory, all the strong effort at the races and for all those testing miles as we come close to the end of our second year.
"Also to Dani: it is great that he believes and trusts in us and what we are doing."
KTM team manager Mike Leitner added: "I'm super-happy that we could reach this agreement with Dani.
"Thanks to all his years and success in MotoGP I believe he will help our project in a big way and in developing the bike.
"Dani is a three-time world champion [125cc in 2003, 250cc in '04 and '05] and three-time runner-up in this category and I know him well from the time working together. He is still very competitive and this can only benefit our MotoGP effort."
Kallio is currently recovering from injuries sustained during a wildcard appearance earlier this year at the Sachsenring, which sidelined him for the rest of 2018.