Millimeter-wave (mm-wave) communications incur a high beam alignment cost in mobile scenarios such as vehicular networks. Therefore, an efficient beam alignment mechanism is required to mitigate the resulting overhead. In this paper, a one-dimensional mobility model is proposed where a mobile user (MU), such as a vehicle, moves along a straight road with time-varying and random speed, and communicates with base stations (BSs) located on the roadside over the mm-wave band. To compensate for location uncertainty, the BS widens its transmission beam and, when a critical beamwidth is achieved, it performs beam-sweeping to refine the MU position estimate, followed by data communication over a narrow beam. The average rate and average transmission power are computed in closed form and the optimal beamwidth for communication, number of sweeping beams, and transmission power allocation are derived so as to maximize the average rate under an average power constraint. Structural properties of the optimal design are proved, and a bisection algorithm to determine the optimal sweeping - communication parameters is designed. It is shown numerically that an adaptation of the IEEE 802.11ad standard to the proposed model exhibits up to 90% degradation in spectral efficiency compared to the proposed scheme.