A large penetration of electric and plug-in hybrid electric vehicles would likely result in increased system peaks and overloading of power system assets if the charging of vehicles is left uncontrolled. In this paper we propose both a centralized and a decentralized smart-charging scheme which seek to minimize system-wide generation costs while respecting grid constraints. Under the centralized scheme, vehicles' batteries are aggregated to virtual storage resources at each network node, which are optimally dispatched with a multiperiod Optimal Power Flow. On the other hand, under the decentralized scheme, price profiles broadcasted to vehicles day-ahead are determined so that the optimal response of individual vehicles to this tariff achieves the goal of cost minimization. Two alternative tariffs are explored, one where the same price profile applies system-wide, and another where different prices can be defined at different nodes. Results show that compared with uncontrolled charging, these smart-charging schemes successfully avoid asset overloading, displace most charging to valley hours and reduce generation costs. Moreover they are robust in the face of forecast errors in vehicle behavior.