Advertising will be banned for most sugary drinks, hamburgers, chocolate bars and salted nuts across the entire Transport for London network, which also includes London Overground, tram services and bus stops.
Fast-food chains will still be allowed to advertise on the tube but only if they promote their healthy products.
They will not be allowed to simply promote their brand or generic logo, to avoid creating a loophole.
Representatives of the advertising industry criticised the move, suggesting it could cost TfL tens of millions of pounds in revenue at a time when the transport system was facing a financial crunch.
The mayor had previously announced his intention to restrict advertising for foods high in fat, sugar and salt but has now confirmed the ban will take effect early next year following a consultation.