Average distance, minimum degree, and spanning trees