We give sufficient conditions for a graph to be traceable and Hamiltonian in terms of the Wiener index and the complement of the graph, which correct and extend the result of Yang [‘Wiener index and traceable graphs’, Bull. Aust. Math. Soc.88 (2013), 380–383]. We also present sufficient conditions for a bipartite graph to be traceable and Hamiltonian in terms of its Wiener index and quasicomplement. Finally, we give sufficient conditions for a graph or a bipartite graph to be traceable and Hamiltonian in terms of its distance spectral radius.