Comcast Corp. is adding YouTube to its video service, bringing the cable giant one step closer to its goal of delivering all video entertainment -- both traditional TV and online streaming -- to its 22.5 million subscribers.

The nation’s largest cable provider will make YouTube available through its X1 interface, which makes it easier to search for movies and TV shows. For example, Comcast subscribers will be able to speak into a voice-controlled remote to find videos. YouTube’s pay service, YouTube Red, will also be available on X1 to subscribers of both services, the companies said.

With the deal, Comcast customers can avoid the hassle of toggling between their cable service and web-connected devices like a Roku Inc. player. By offering web videos the same way it delivers traditional cable channels, Comcast is hoping to persuade TV subscribers to stick around. After some subscriber defections, the company has added new users in four of the last five quarters.

For YouTube, distribution on Comcast’s platform not only gets videos in front of more people, but helps the company tap into the $63 billion TV advertising market, as brands have larger budgets for ads seen on actual televisions in consumers’ homes.

YouTube is the latest popular web service to be available on X1. The deal follows a similar one that Comcast announced last year with Netflix Inc. Other popular streaming services, like Amazon Prime, aren’t available on Comcast’s X1.

Comcast and Alphabet Inc., the parent of Google and YouTube, haven’t always gotten along. Last year, the two companies were on the opposite sides of a proposal to free consumers from renting cable boxes. The Federal Communications Commission recently withdrew the proposal from consideration. Google also attempted to compete with Comcast in offering high-speed Internet service in several cities, but has scaled back its ambitions as a broadband provider. YouTube is also working on a cable-like live TV service that will compete directly with Comcast’s cable TV service.