Let p be a prime, and N be a positive integer not divisible by p. Let \( \textrm{ord}_N(p) \) denote the multiplicative order of p modulo N. Let \( \mathbb {F}_q \) represent the finite field of order \( q=p^{\textrm{ord}_N(p)} \) . For \( a, b\in \mathbb {F}_q \) , we define a binomial Weil sum by \(S_N(a,b):=\sum _{x\in \mathbb {F}_q\setminus \{0\}}\chi (ax^{(q-1)/N}+bx),\) where \( \chi \) is the canonical additive character of \( \mathbb {F}_q \) . In this paper, we provide a new method to evaluate \( S_{N}(a,b) \) for any odd prime p and any N satisfying \( \textrm{ord}_{N}(p)=\phi (N) \) , where \( \phi \) is the Euler totient function. This approach facilitates the construction of a family of ternary linear codes with completely determined weight distributions. Additionally, we demonstrate that the dual codes are optimal with respect to the sphere packing bound.