Power data analysis in power system, such as electricity consumption prediction, has always been the basis for the power department to adjust electricity price, substation regulation, total load prediction and peak avoidance management. In this paper, a short‐term time‐phased electricity consumption prediction model based on Long Short‐Term Memory (LSTM) with an attention mechanism is proposed. First, the attention mechanism is used to assign weight coefficients to the input sequence data. Then, the output value of every cell of LSTM is calculated according to the forward propagation method, and the error between the real value and the predicted value is calculated using the back‐propagation method. The gradient of each weight is calculated according to the corresponding error term, and the weight of the model is updated by the gradient descent direction to make the error smaller. Using modeling and predicting experiments on different types of electricity consumption, the results show that the prediction accuracy of the model proposed increased by 6.5% compared to the state‐of‐the‐art model. The model has a good effect on electricity consumption prediction. Not only can it be close to actual results numerically, but it can also better predict the development trend of data. © 2020 Institute of Electrical Engineers of Japan. Published by John Wiley & Sons, Inc.