In this paper, the theory and algorithm on a class of optimal curve fitting problems which can be extensively applied to the engineering are established and completed. With regard to the curve fitting problems, the available theories and methods are largely concerned with the spline interpolation and linear or nonlinear least squares methods, and there are lots of ripe results. To my best knowledge, however, in view of the complexity, the third method, that is, to resort to solve functional extremal problems remains completed both in theories and algorithms. Regarding the class of this problems, that is here called as the optimal curve fitting problems under relaxation constraints, the analytic expression of solution and solving algorithms were discussed in [P. Cheng, K.C. Zhang, On a class of constrained functional minimization problems and their numerical solution, Journal of optimization theory and applications, 78(2) (1993) P267–P287; P. Cheng, KC. Zhang, Unified method for a kind of constrained functional minimization, Computing technology and automation, 10(2) (1991) 13–25; K.C. Zhang, A numerical method for solving a class of variation problems with constraint and its application to engineering, Numerical Mathematics, A Journal of Chinese Universities,11(2) (1989) 1–9; K.C. Zhang, The Algorithm and Analysis of Numerical Computation, Beijing, Science Press, 2003, pp. 172–184]. But the existence of optimal solution has not been solved so far. In the paper, with help of variational principle and convexity analysis, we give the proof of existence in details and a different proof about the analytic expression of optimal solution. Moreover, we prove that, for every smoothing parameter m, this class of optimal curve fitting problems is equivalent to solve a quadratic programming with a spherical constraint which usually appears in the trust-region and SQP subproblems, and its algorithms have been quite ripe. Therefore, a novel algorithm different from Zhang (2003) for this class problems is established. Finally, we give an example of m = 2 to validate our theory and method. Numerical test shows that the method is effective and practical.