Oriented object detection (OOD) can recognize and locate various objects more precisely than horizontal object detection; however, two problems have not been satisfactorily resolved so far. Firstly, the absence of interactions between the classification and regression branches leads to inconsistent performance in the two tasks of object detection. Secondly, the traditional convolution operation cannot precisely extract the features of objects in extremely aspect ratio in remote sensing images (RSIs). To address the first problem, the task-aligned detection module (TADM) and the task-aligned loss function (TL) are proposed in this paper. On the one hand, a spatial probability map and a spatial offset map are inferred from the shared features in the TADM and separately incorporated into the classification and regression branches to obtain consistency in the two tasks. On the other hand, the TL combines employing the generalized intersection over union (GIoU) metric with classification loss to further enhance the consistency in the two tasks. To address the second problem, a two-stage detection framework based on alignment convolution (TDA) is proposed. The features extracted from the backbone network are refined through alignment convolution in the first stage, and the final OOD results are inferred from refined features in the second stage. The ablation study verifies the effectiveness of the TADM, TL, and TDA. The comparisons with other advanced methods, on two RSI benchmarks, demonstrate the overall effectiveness of our method.