The time-dependent traveling salesman problem with time windows (TDTSPTW) is a variant of the well-known traveling salesman problem with time windows, in which travel times are not assumed to be constant. The TDTSPTW accounts for the effects of congestion at the planning level, being particularly suited for distribution problems in large cities. In this paper we develop a labeling-based algorithm for the TDTSPTW that incorporates partial dominance and generalizes several state-of-the-art components from the time-independent related literature. We propose a framework general enough to be applied to the TDTSPTW and its variant without time windows, with the objective of minimizing the duration or the makespan. As part of the framework, we introduce a new state-space relaxation specifically designed for the time-dependent context. Extensive computational experiments show the effectiveness of the overall approach and the impact of the new relaxation, outperforming several recent algorithms proposed for these variants on more than 9,000 benchmark instances. In addition, we frame the minimum tour duration problem within the time-dependent literature and include it as a benchmark for our algorithm, obtaining improved computation times and 31 new optimal solutions. Summary of Contribution: In this paper, we study the time-dependent traveling salesman problem with time windows (TDTSPTW), a difficult single-vehicle routing problem that incorporates more realistic travel time functions than its classic time-independent counterpart. As a result, the TDTSPTW is harder to solve, as it requires more complex models and algorithms. Using state-of-the-art optimization techniques, we propose an efficient solution approach for the TDTSPTW and some related variants that outperforms the previous approaches in the literature. Our paper emphasizes the importance of algorithmic design and efficient implementations to tackle relevant practical combinatorial optimization problems—in particular, for time-dependent problems. Moreover, the resulting algorithm fosters a new research direction regarding exact algorithms for time-dependent problems using dynamic programming and relaxation techniques. History: Accepted by Andrea Lodi, Area Editor for Design & Analysis of Algorithms—Discrete. Funding: This research has been funded by Fondo para la Investigación Científica y Tecnológica (FONCyT) [Grants PICT-2016-2677 and PICT-2018-2961] from the Ministry of Science, Argentina, and by the Google Latin America Research Award (LARA) 2019. Supplemental Material: The online appendix is available at https://doi.org/10.1287/ijoc.2022.1236 .