In this paper, ant algorithm (AA) which is a new nature-inspired optimization technique, was used to tune a PID controller. In the tuning process, the following cost functions were employed: i) Integral Absolute Error (IAE), ii) Integral Squared Error (ISE), iii) a new proposed cost function called reference based error with minimum control effort (RBEMCE). The results obtained from ant algorithm PID tuning process were also compared with the results of Ziegler-Nichols (ZN), Internal Model Control (IMC) and Iterative Feedback Tuning (IFT) methods. The PID controllers optimized with ant algorithm and the new proposed cost function gives a performance that is at least as good as that of the PID tuning methods mentioned above. With our method, a faster settling time, less or no overshoot and higher robustness were achieved. Moreover, the new tuning process is successful in the presence of high noise.