In real-time large-scale optimization problems, such as in smart grids, centralized algorithms may face difficulties in handling fast-varying system conditions, such as high variability of renewable-based distributed generators (DGs) and controllable loads (CLs). Further, centralized algorithms may encounter computation and communication bottlenecks while handling a large number of variables. To tackle these issues, consensus-based distributed strategies have been proposed recently. However, distributed computational intelligence (CI)-based techniques can provide a much better near-optimal solution within fewer iterations of the algorithm, which is a critical requirement in smart grids. Therefore, in this paper, a consensus-based dimension-distributed CI technique is proposed for real-time optimal control in smart distribution grids in which a large number of DGs and CLs are present. The proposed approach considers each DG or CL as a separate private entity, which is more relevant from the perspective of smart grid optimization. In the proposed consensus-based framework, each DG or CL is associated with an agent, and each agent is allowed to communicate only with its neighboring agents. The effectiveness of the proposed approach in terms of convergence, adaptability, and optimality with respect to a centralized algorithm and a benchmark algorithm is shown through simulations on 30-node and 119-node distribution test systems.