Unmanned surface vessels (USVs) are widely used in ocean exploration and environmental protection fields. To ensure that USV can successfully perform its mission, trajectory planning and motion tracking are the two most critical technologies. In this paper, we propose a novel trajectory generation and tracking method for USV based on optimization theory. Specifically, the USV dynamic model is described with differential flatness, so that the trajectory can be generated by dynamic RRT* in a linear invariant system expression form under the objective of optimal boundary value. To reduce the sample number and improve efficiency, we adjust the trajectory through local optimization. The dynamic constraints are considered in the optimization process so that the generated trajectory conforms to the kinematic characteristics of the under-actuated hull, and makes it easier to be tracked. Finally, motion tracking is added with model predictive control under a sequential quadratic programming problem. Experimental results show the planned trajectory is more in line with the kinematic characteristics of USV, and the tracking accuracy remains a higher level.