A k-tree is a tree with maximum degree at most k. For a graph G and u,v∈V(G) with uv∉E(G), let α(u,v;G) be the cardinality of a maximum independent set containing u and v. For a graph G and u,v∈V(G), the local connectivity κ(u,v;G) is defined to be the maximum number of internally disjoint paths connecting u and v in G. In this paper, we prove the following theorem and show the condition is sharp. Let k, s and t be integers with k≥3, 0≤s≤k and 2≤t≤k. For any two nonadjacent vertices u and v of G, we have κ(u,v;G)≥s+1 and α(u,v;G)≤(κ(u,v;G)−s)(k−1)+s(t−1)+1. Then for any s distinct vertices of G, G has a spanning k-tree such that each of s specified vertices has degree at most t. This theorem implies H. Matsuda and H. Matsumura’s result in [on a k-tree containing specified cleares in a graph, Graphs Combin.22 (2006) 371–381] and V. Neumann-Lara and E. Rivera-Campo’s result in [Spanning trees with bounded degrees, Combinatorica11 (1991) 55–61].