The 'Gone Girl' actor, who has previously emceed the Tony Awards and the Emmys several times, will present the star-studded 87th annual ceremony at the Dolby Theatre in Los Angeles on February 22.
The 41-year-old star announced the news on Twitter on Wednesday by posting a video clip of himself telling an unidentified person "I'm in" during a phone call.
The 'How I Met Your Mother' star, who recently married his long-term boyfriend David Burtka, with whom he has four-year-old twins, Harper and Gideon, is then seen consulting his bucket list, which includes having children, getting married and meeting the president, and circling the final item that reads "host the Oscars" with a black pen.
In a statement, he added: "It is truly an honor and a thrill to be asked to host this year's Academy Awards. I grew up watching the Oscars and was always in such awe of some of the greats who hosted the show. To be asked to follow in the footsteps of Johnny Carson, Billy Crystal, Ellen DeGeneres, and everyone else who had the great fortune of hosting is a bucket list dream come true."
Talk show queen Ellen hosted this year's ceremony in March, which scored the best ratings in 14 years, but declined an offer to take on the job again.
'Veep' star Julia Louis-Dreyfus was also offered the role and turned it down, according to The Hollywood Reporter.