*Stay with me here, because this is a long one and it deserves quite a bit of thought. The ending seems overly rushed. Aang almost becomes the Deus ex Machina when he suddenly appears and claims that Korra has connected to her spiritual side out of the blue, before restoring Korra's bending and making her a fully realized Avatar by completing the connection with all her past lives and activating the Avatar State. But when you think of it, there's a LOT that's happened in Korra's spiritual development leading up to this point. Korra's been trying to train spiritually for years and was trained by Tenzin for quite a while, and it was beginning to work very well. Her abilities at the end of Episode 9 was already on par with Aang in season 3 of ATLA. Also Korra's style and personality are like that of Earth, stubborn and unyielding. It's only when she's totally put into a situation where her current approach cannot work, does she suddenly get the hold of airbending and is able to connect with Aang's visions. That is saying a lot about chakras at work in her spiritual and airbending blocks. That's the key to explaining how the ending turned out the way it did. Korra's hitting the absolute low was the final turning point, but there was a lot of spiritual development that had happened up to that point.
*The Earth Chakra was opened when Korra learnt to face her fear of dealing with Amon. The Water Chakra was opened when she was able to overcome her guilt when she got over the love triangle by forgiveness and got them through into the final, though it might have even happened before that when she got the knack of the airbending movements. The Fire Chakra was opened up when she reconciled with Tenzin over her shame of not being able to airbend or being spiritually weak, and when she finally connected with Aang. The Air Chakra was obviously opened by love, and I mean Mako. The Sound Chakra was opened when she understood Tarrlok and Amon's true identities, and Amon building his whole movement on lying over his backstory. The Hiroshi Sato reveal also definitely had something to do with it. The light Chakra was probably opened somewhere between Korra realizing that she could still airbend and Amon's makeup job and waterbending powers exposed. The air chakra was probably fully open in that moment where Mako was about to lose his bending, which is why she could Airbend. Finally the last chakra was unblocked when she was planning to leave everyone and told Mako to leave her for good, despite the fact that both truly loved each other by this point - probably she was contemplating suicide, now that she could no longer do her job as the Avatar and called Aang, likely with the intention of taking her away to the spirit world, which is when she gave up attachment. That's when all her chakras were open and her spiritual connection became truly complete. While it's difficult to often pinpoint the incident as the cause of opening her chakras, it's clear that following Character Development Korra already very spiritual by the end and had successfully opened all her chakras allowed her to master the Avatar state. All that was now needed was a little help from Aang to energybend her broken connections.
*This also makes sense why Korra never went into the Avatar State despite being in danger so often. She had already begun to open her chakras, and until all the chakras were opened, she couldn't enter it.
*This also suggests that Korra's restrained and cocooned upbringing in that South Pole fortress also caused the spiritual block in her owing to insufficient Character Development. Katara knew this, the White Lotus didn't. Tenzin figured it out after Korra's first pro-bending match that her spirit really needs freedom to grow.
*Aang's statement that in her lowest moments, she was open to the greatest change, was just summing up the way she had unknowingly more and more spiritual by life experience. Aang's energybending was the last piece of the puzzle. Now Korra having lost her connection to 3 elements is totally helpless to solve things by her usual badassery and so has had to let go of her pride, the reason for her spiritual block. All this time she had been feeling that she never needed the spiritual side because she had been so Badass, but now she had been humbled and her spirit was malleable to Aang's energybending. All that was left for Aang to do was to energybend Korra to restore her bending.
*It makes more Fridge Brilliance. Becoming a fully realized Avatar involves mastering both the physical and spiritual sides of bending. The two of them are related and influence each other. Aang could bend with his chakras closed. He was wounded by lightning, and while he could still bend all the elements, he had lost his spiritual connection to all but 4 of his past lives and the Avatar State. He regained it by a purely physical means of having his blocked chi paths opened up by a sharp rock, which spiritually unblocked him. Throughout the series there has been quite a connection between Energybending and the Avatar State, with Aang using the Avatar State to debend Ozai and Yakhone. He was shown to have mastered the Avatar State after he had successfully energybended Ozai. Korra on the other hand, as the opposite of Aang, lost her connection to the physical side of bending, but by that point her chakras were open, she had completely mastered the spiritual side and connected with the spirits of the past Avatars, thus allowing her to master the Avatar State. Aang then uses the Avatar State to energybend Korra at a spiritual level, restoring her physical connection to her elements, making Korra a fully realized Avatar.
*Ah, if only some of this had been explained or at least pointed out in the dialgoue, the ending would have been much better appreciated
*It's already been noted by a lot of fans before that the plot is symbolic of how the chakras are opened, by dealing with fear, guilt, shame, grief (and love), truth and lies, illusion and attachment. Aang's chakras were blocked by all his experiences and the fact that he had responded in the manner that would lock them up. Korra on the other hand face similar situations but responded in the way that would open them. Maybe the writers know that ATLA fans aren't morons and don't feel the need to spell out the beautiful symbolism behind the plot, which would cheapen the effect.