Australia won an all-time classic Test, taking seven wickets in the final session on day five to defeat India by 184 runs.