For the parallel parking problem in narrow space, this paper proposes a trajectory tracking control method with a novel trajectory planning layer for autonomous parallel parking based on a numerical optimization algorithm and model predictive control. In the trajectory planning layer, the vehicle kinematics model suitable for the low-velocity parking scene is established. Considering the vehicle physical constraints, boundary condition constraints, and obstacle avoidance constraints during the parking process, the parking trajectory planning task is described as an optimal control problem, further transformed into a nonlinear programming problem by Gauss pseudo-spectral method. Taking the shortest parking completion time as the optimization objective function, the parking trajectories of the large, medium and small parking spaces are obtained, respectively. A parking trajectory tracking controller based on the model predictive control algorithm is designed in the trajectory tracking control layer. The linear error model is used as the prediction model, and the quadratic programming is adopted as the rolling optimization algorithm in the tracking controller. The velocity and front-wheel swing angle are obtained as control signals for parking trajectory tracking. Through CarSim and Simulink's co-simulation, the feasibility and effectiveness of the proposed parallel parking trajectory planning and tracking control method are verified. The co-simulation results show that the maximum tracking errors of horizontal and longitudinal positions are less than 0.15m. The maximum tracking errors of heading angle are less than 2° under three different parking spaces. Real vehicle tests are carried out to verify the effectiveness of the proposed hierarchical control method. The test results show that the vehicle can park in the parking space safely, quickly and accurately when the actual parking space is detected. The proposed method can plan the parking trajectory with the constraints and the shortest time and control the vehicle to complete the parking operation accurately along the planned trajectory.